Stacks¶
marimo.hstack
¶
hstack(
items: Sequence[object],
*,
justify: Literal[
"start",
"center",
"end",
"space-between",
"space-around",
] = "space-between",
align: Optional[
Literal["start", "end", "center", "stretch"]
] = None,
wrap: bool = False,
gap: float = 0.5,
widths: Optional[
Literal["equal"] | Sequence[float]
] = None
) -> Html
Stack items horizontally, in a row.
Combine with vstack
to build a grid.
Examples:
Build a row of items:
Build a grid:
# Build a grid.
mo.hstack(
[
mo.vstack([mo.md("..."), mo.ui.text_area()]),
mo.vstack([mo.ui.checkbox(), mo.ui.text(), mo.ui.date()]),
]
)
PARAMETER | DESCRIPTION |
---|---|
items
|
A list of items.
TYPE:
|
justify
|
Justify items horizontally: start, center, end, space-between, or space-around. Defaults to "space-between".
TYPE:
|
align
|
Align items vertically: start, end, center, or stretch.
TYPE:
|
wrap
|
Wrap items or not. Defaults to False.
TYPE:
|
gap
|
Gap between items as a float in rem. 1rem is 16px by default. Defaults to 0.5.
TYPE:
|
widths
|
"equal" to give items
equal width; or a list of relative widths with same length as
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Html
|
An Html object.
TYPE:
|
marimo.vstack
¶
vstack(
items: Sequence[object],
*,
align: Optional[
Literal["start", "end", "center", "stretch"]
] = None,
justify: Literal[
"start",
"center",
"end",
"space-between",
"space-around",
] = "start",
gap: float = 0.5,
heights: Optional[
Literal["equal"] | Sequence[float]
] = None
) -> Html
Stack items vertically, in a column.
Combine with hstack
to build a grid of items.
Examples:
Build a column of items:
Build a grid:
# Build a grid.
mo.vstack(
[
mo.hstack([mo.md("..."), mo.ui.text_area()]),
mo.hstack([mo.ui.checkbox(), mo.ui.text(), mo.ui.date()]),
]
)
PARAMETER | DESCRIPTION |
---|---|
items
|
A list of items.
TYPE:
|
align
|
Align items horizontally: start, end, center, or stretch.
TYPE:
|
justify
|
Justify items vertically: start, center, end, space-between, or space-around. Defaults to "start".
TYPE:
|
gap
|
Gap between items as a float in rem. 1rem is 16px by default. Defaults to 0.5.
TYPE:
|
heights
|
"equal" to give items
equal height; or a list of relative heights with same length as
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Html
|
An Html object.
TYPE:
|