Components / Layout and type
Stack
Flex column (or row) with token-based gaps.
import { Stack } from "@stylhero/ui";
Example
Code
import { Paper, Stack } from "@stylhero/ui";
const tile = (label: string) => <Paper key={label} padding={3} outlined>{label}</Paper>;
function StackExample() {
return (
<Stack gap={4}>
<Stack direction="row" gap={2}>{["One", "Two", "Three"].map(tile)}</Stack>
<Stack gap={2}>{["Column", "of", "items"].map(tile)}</Stack>
</Stack>
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
align |
CSSProperties["alignItems"] |
- | |
as |
ElementType |
"div" |
|
direction |
"column" | "row" |
"column" |
|
gap |
Space |
3 |
|
justify |
CSSProperties["justifyContent"] |
- | |
wrap |
boolean |
- |
Also takes the HTML attributes of its root element (id, style, data-*, aria-*, event handlers…).
Types
type Space = 0 | 1 | 2 | 3 | 4 | 6 | 8 | 12;
Generated from src/components/Stack.tsx. Something wrong or missing? Open an issue.