Skip to content
Page

Stack

One-axis flex layout with spacing tokens for the gap.

Vertical stackChildren are spaced with a spacing token.
Row with space between
import { Stack } from "@pelagornis/page/components";

The preview above renders this file. Copy it into src/components/ to start from it.

src/components/StackExample.tsx
import { Button, Stack, Text } from "@pelagornis/page/components";
export default function StackDemo() {
return (
<Stack gap="sizeLarge" className="w-full">
<Stack gap="sizeXXSmall">
<Text variant="subtitleMd">Vertical stack</Text>
<Text variant="bodySm">Children are spaced with a spacing token.</Text>
</Stack>
<Stack direction="row" gap="sizeSmall" align="center" justify="between">
<Text variant="bodyMd">Row with space between</Text>
<Stack direction="row" gap="sizeSmall">
<Button variant="outline">Cancel</Button>
<Button variant="primary">Save</Button>
</Stack>
</Stack>
</Stack>
);
}

Stack can be written straight in an .mdx page. Import it below the frontmatter. It renders on the server, so no client directive is needed.

src/content/docs/example.mdx
---
title: Example
---
import { Button, Stack } from "@pelagornis/page/components";
<Stack direction="row" gap="sizeSmall" align="center">
<Button variant="outline">Cancel</Button>
<Button variant="primary">Save</Button>
</Stack>

pageMarkdoc() registers a stack tag for this component. Add the preset once in markdoc.config.mjs (see Use in Markdoc), then write the tag in any .mdoc page.

src/content/docs/example.mdoc
{% stack direction="row" gap="sizeSmall" align="center" %}
{% button variant="outline" %}Cancel{% /button %}
{% button variant="primary" %}Save{% /button %}
{% /stack %}

Attributes use the same names and values as the React props.

Parts of the component and the data-refineui role each one renders.

PartRole
rootstack