express.ui.card_body
express.ui.card_body(
fillable=True,
min_height=None,
max_height=None,
max_height_full_screen=MISSING,
height=None,
padding=None,
gap=None,
fill=True,
class_=None,
**kwargs,
)Card body container
A general container for the "main content" of a card. This component is designed to be provided as direct children to card.
Parameters
*args :-
Contents to the card’s body. Or tag attributes that are supplied to the resolved
Tagobject. fillable : bool = True-
Whether or not the card item should be a fillable (i.e. flexbox) container.
min_height : Optional[CssUnit] = None-
Any valid CSS length unit. If
max_height_full_screenis missing, it is set tomax_height. height : Optional[CssUnit] = None-
Any valid CSS unit (e.g.,
height="200px"). Doesn’t apply when a card is madefull_screen(in this case, consider setting aheightincard_body()). padding : Optional[CssUnit|list[CssUnit]] = None-
Padding to use for the body. This can be a numeric vector (which will be interpreted as pixels) or a character vector with valid CSS lengths. The length can be between one and four. If one, then that value will be used for all four sides. If two, then the first value will be used for the top and bottom, while the second value will be used for left and right. If three, then the first will be used for top, the second will be left and right, and the third will be bottom. If four, then the values will be interpreted as top, right, bottom, and left respectively.
gap : Optional[CssUnit] = None-
A CSS length unit defining the
gap(i.e., spacing) between elements provided to*args. This argument is only applicable whenfillable = TRUE. fill : bool = True-
Whether to allow this element to grow/shrink to fit its
cardcontainer. class_ : Optional[str] = None-
Additional CSS classes for the returned Tag.
**kwargs : TagAttrValue = {}-
Additional HTML attributes for the returned Tag.
Returns
:RecallContextManager[CardItem]-
A
CardItemobject.
See Also
layout_column_wrapfor laying out multiple cards (or multiple columns inside a card).cardfor creating a card component.card_headerfor creating a header within the card.card_footerfor creating a footer within the card.
Examples
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
## file: app.py
from shiny.express import ui
with ui.card(full_screen=True):
ui.card_header("This is the header")
with ui.card_body():
ui.tags.h5("This is the title")
ui.p("This is the body.")
ui.p("This is still the body.")
ui.card_footer("This is the footer")
with ui.card():
ui.p("These first two elements will be wrapped in `card_body()` together.")
ui.p("These first two elements will be wrapped in `card_body()` together.")
with ui.card_body():
ui.p("A card body.")
ui.p("These last two elements will be wrapped in `card_body()` together.")
ui.p("These last two elements will be wrapped in `card_body()` together.")