Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* Added support for using `shiny.express` in Quarto Dashboards. (#1217)

* `ui.value_box()`, `ui.layout_columns()` and `ui.layout_column_wrap()` now all have `min_height` and `max_height` arguments. These are useful in filling layouts, like `ui.page_fillable()`, `ui.page_sidebar(fillable=True)` or `ui.page_navbar(fillable=True)`. For example, you can use `ui.layout_columns(min_height=300, max_height=500)` to ensure that a set of items (likely arranged in a row of columns) are always between 300 and 500 pixels tall. (#1223)

### Bug fixes

* On Windows, Shiny Express app files are now read in as UTF-8. (#1203)
Expand Down
28 changes: 21 additions & 7 deletions shiny/express/ui/_cm_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ def layout_column_wrap(
fill: bool = True,
fillable: bool = True,
height: Optional[CssUnit] = None,
min_height: Optional[CssUnit] = None,
max_height: Optional[CssUnit] = None,
height_mobile: Optional[CssUnit] = None,
gap: Optional[CssUnit] = None,
class_: Optional[str] = None,
Expand Down Expand Up @@ -267,8 +269,10 @@ def layout_column_wrap(
with an opinionated height (e.g., :func:`~shiny.ui.page_fillable`).
fillable
Whether or not each element is wrapped in a fillable container.
height
Any valid CSS unit to use for the height.
height,max_height,min_height
A valid CSS unit (e.g., `height="200px"`). Use `min_height` and `max_height` in
a filling layout to ensure that the layout container does not shrink below a
`min_height` or grow beyond a `max_height`.
height_mobile
Any valid CSS unit to use for the height when on mobile devices (or narrow
windows).
Expand All @@ -288,6 +292,8 @@ def layout_column_wrap(
fill=fill,
fillable=fillable,
height=height,
min_height=min_height,
max_height=max_height,
height_mobile=height_mobile,
gap=gap,
class_=class_,
Expand All @@ -306,6 +312,8 @@ def layout_columns(
gap: Optional[CssUnit] = None,
class_: Optional[str] = None,
height: Optional[CssUnit] = None,
min_height: Optional[CssUnit] = None,
max_height: Optional[CssUnit] = None,
**kwargs: TagAttrValue,
) -> RecallContextManager[Tag]:
"""
Expand Down Expand Up @@ -368,8 +376,10 @@ def layout_columns(
class_
CSS class(es) to apply to the containing element.

height
Any valid CSS unit to use for the height.
height,max_height,min_height
A valid CSS unit (e.g., `height="200px"`). Use `min_height` and `max_height` in
a filling layout to ensure that the layout container does not shrink below a
`min_height` or grow beyond a `max_height`.

**kwargs
Additional attributes to apply to the containing element.
Expand Down Expand Up @@ -399,6 +409,8 @@ def layout_columns(
gap=gap,
class_=class_,
height=height,
min_height=min_height,
max_height=max_height,
**kwargs,
),
)
Expand Down Expand Up @@ -1153,6 +1165,7 @@ def value_box(
theme: Optional[str | ui.ValueBoxTheme] = None,
height: Optional[CssUnit] = None,
max_height: Optional[CssUnit] = None,
min_height: Optional[CssUnit] = None,
fill: bool = True,
class_: Optional[str] = None,
**kwargs: TagAttrValue,
Expand Down Expand Up @@ -1195,9 +1208,9 @@ def value_box(
full_screen
If `True`, an icon will appear when hovering over the card body. Clicking the
icon expands the card to fit viewport size.
height,max_height
Any valid CSS unit (e.g., `height="200px"`). Doesn't apply when a card is made
`full_screen`.
height,max_height,min_height
Any valid CSS unit (e.g., `height="200px"`). Doesn't apply when a value box is
made `full_screen`.
fill
Whether to allow the value box to grow/shrink to fit a fillable container with
an opinionated height (e.g., :func:`~shiny.ui.page_fillable`).
Expand All @@ -1217,6 +1230,7 @@ def value_box(
theme=theme,
height=height,
max_height=max_height,
min_height=min_height,
fill=fill,
class_=class_,
**kwargs,
Expand Down
10 changes: 8 additions & 2 deletions shiny/ui/_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def layout_column_wrap(
fill: bool = True,
fillable: bool = True,
height: Optional[CssUnit] = None,
min_height: Optional[CssUnit] = None,
max_height: Optional[CssUnit] = None,
height_mobile: Optional[CssUnit] = None,
gap: Optional[CssUnit] = None,
class_: Optional[str] = None,
Expand Down Expand Up @@ -74,8 +76,10 @@ def layout_column_wrap(
with an opinionated height (e.g., :func:`~shiny.ui.page_fillable`).
fillable
Whether or not each element is wrapped in a fillable container.
height
Any valid CSS unit to use for the height.
height,max_height,min_height
A valid CSS unit (e.g., `height="200px"`). Use `min_height` and `max_height` in
a filling layout to ensure that the layout container does not shrink below a
`min_height` or grow beyond a `max_height`.
height_mobile
Any valid CSS unit to use for the height when on mobile devices (or narrow
windows).
Expand Down Expand Up @@ -146,6 +150,8 @@ def layout_column_wrap(
"auto" if height_mobile is None else height_mobile
),
"gap": as_css_unit(gap),
"min-height": as_css_unit(min_height),
"max-height": as_css_unit(max_height),
}

tag = div(
Expand Down
10 changes: 8 additions & 2 deletions shiny/ui/_layout_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def layout_columns(
gap: Optional[CssUnit] = None,
class_: Optional[str] = None,
height: Optional[CssUnit] = None,
min_height: Optional[CssUnit] = None,
max_height: Optional[CssUnit] = None,
**kwargs: TagAttrValue,
) -> Tag:
"""
Expand Down Expand Up @@ -98,8 +100,10 @@ def layout_columns(
Any valid CSS unit to use for the gap between columns.
class_
CSS class(es) to apply to the containing element.
height
Any valid CSS unit to use for the height.
height,max_height,min_height
A valid CSS unit (e.g., `height="200px"`). Use `min_height` and `max_height` in
a filling layout to ensure that the layout container does not shrink below a
`min_height` or grow beyond a `max_height`.
**kwargs
Additional attributes to apply to the containing element.

Expand Down Expand Up @@ -129,6 +133,8 @@ def layout_columns(
"style": css(
gap=as_css_unit(gap),
height=as_css_unit(height),
min_height=as_css_unit(min_height),
max_height=as_css_unit(max_height),
),
},
col_widths_attrs(col_widths_spec),
Expand Down
8 changes: 5 additions & 3 deletions shiny/ui/_valuebox.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ def value_box(
theme: Optional[str | ValueBoxTheme] = None,
height: Optional[CssUnit] = None,
max_height: Optional[CssUnit] = None,
min_height: Optional[CssUnit] = None,
fill: bool = True,
class_: Optional[str] = None,
id: Optional[str] = None,
Expand Down Expand Up @@ -358,9 +359,9 @@ def value_box(
full_screen
If `True`, an icon will appear when hovering over the card body. Clicking the
icon expands the card to fit viewport size.
height,max_height
Any valid CSS unit (e.g., `height="200px"`). Doesn't apply when a card is made
`full_screen`.
height,max_height,min_height
Any valid CSS unit (e.g., `height="200px"`). Doesn't apply when a value box is
made `full_screen`.
fill
Whether to allow the value box to grow/shrink to fit a fillable container with
an opinionated height (e.g., :func:`~shiny.ui.page_fillable`).
Expand Down Expand Up @@ -463,6 +464,7 @@ def value_box(
full_screen=full_screen,
height=height,
max_height=max_height,
min_height=min_height,
fill=fill,
id=id,
)
Expand Down