Stack
Flex layout with gaps from the spacing scale. Column by default; direction="row" for horizontal.
Status: stable. Category: Layout.
import { Stack } from '@glyphui/ui'
Exports: Stack, stackStyles.
Stack props
| Prop | Type | Default | Description |
|---|---|---|---|
align | "center" | "baseline" | "start" | "end" | "stretch" | ||
asChild | boolean | ||
direction | "row" | "column" | ||
gap | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | ||
justify | "center" | "start" | "end" | "between" | ||
wrap | boolean |
Example: Column
import { Heading, Stack, Text } from '@glyphui/ui'
export default function Example() {
return (
<Stack gap={2} className="max-w-md">
<Heading level={3}>Invite your team</Heading>
<Text tone="muted">Everyone you invite joins as a member. You can change roles later.</Text>
</Stack>
)
}
Example: Row
import { Button, Stack, Text } from '@glyphui/ui'
export default function Example() {
return (
<Stack direction="row" align="center" justify="between" gap={3} wrap className="max-w-md">
<Text size="small" tone="muted">
3 unsaved changes
</Text>
<Stack direction="row" gap={2}>
<Button variant="ghost" size="sm">
Discard
</Button>
<Button size="sm">Save</Button>
</Stack>
</Stack>
)
}
Live page: https://glyphui.xyz/components/stack