Skip to content
Page

Button

Starts an action such as save, continue, or open a panel.

import { Button } from "@pelagornis/page/components";

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

src/components/ButtonExample.tsx
import { Button, Stack, WebIcon } from "@pelagornis/page/components";
export default function ButtonDemo() {
return (
<Stack direction="row" gap="sizeSmall" align="center" wrap>
<Button variant="primary">Continue</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="outline">Outline</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="primary" disabled>
Disabled
</Button>
<Button variant="ghost" layout="icon" aria-label="Add">
<WebIcon name="add" size={20} color="currentColor" />
</Button>
</Stack>
);
}

Button 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 } from "@pelagornis/page/components";
<Button variant="primary">Continue</Button>
<Button variant="outline" size="sm">Cancel</Button>

pageMarkdoc() registers a button 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
{% button variant="primary" %}Continue{% /button %}
{% button variant="outline" size="sm" %}Cancel{% /button %}

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

Values the component accepts for each variant prop.

PropValues
variantprimary secondary outline ghost
sizesm md lg
layoutlabel icon

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

PartRole
rootbutton
iconoptional
labelrequired

States the component styles. Component states are exposed as data attributes.

KindStates
Pseudohover active focus-visible
Availabilitydisabled aria-disabled data-inactive
data-stateloading

Keys the component handles when it has focus.

KeyAction
Enteractivate
Spaceactivate