Stack
Place a set of elements one next to the other.
Use Stack when you need precise control over the alignment and spacing of similar items, such as
in toolbars or button groups. Use Cols for proportional columns that fill the available width.
Usage
Group the elements to stack in a Stack component.
<script>
import { Button, Stack } from "@makigas/genshi-svelte";
</script>
<Stack>
<Button>Compose</Button>
<Button>Reply</Button>
<Button>Reply All</Button>
<Button>Forward</Button>
</Stack>
Items wrap onto another line when the container runs out of room. Use Cols for a single row of
columns on larger screens. Resize the window to see the buttons wrap in the example below.
Props
| Name | Type | Purpose |
|---|---|---|
direction | "horizontal" | "vertical" | Main axis direction of the elements. |
align | "start" | "end" | "center" | "fill" | Axis alignment of the elements. |
reversed | boolean | Reverse the order of the nodes in the document. |
baseline | "top" | "middle" | "bottom" | "hexpand" | Opposite order of the elements. |
gap | "none" | "sm" | "md" | "lg" | "xl" | Gap between elements. |
Stack alignment
Use the align prop to position items along the stack direction.
align="start"groups items at the start of the container.align="end"groups items at the end of the container.align="center"centers the group in the container.align="fill"spreads items across the container with space between them.
Stack direction
By default, the stack is horizontal and items follow the source order. Use direction and
reversed to change the layout.
direction="horizontal"lays out items horizontally.direction="horizontal" reversedreverses the visual order in a horizontal stack.direction="vertical"stacks items vertically.direction="vertical" reversedreverses the visual order in a vertical stack.
Stack baseline
Use the baseline prop to align items across the stack direction.
baseline="top"aligns items to the start of the cross axis.baseline="middle"centers items on the cross axis.baseline="bottom"aligns items to the end of the cross axis.baseline="hexpand"stretches items along the cross axis.
Gap size
Use the gap prop to set the space between items. The fallback is md.