Button
Variants
Section titled “Variants”Primary
Section titled “Primary”The most important action on a page.
import { Button } from '@eekodigital/raster';
<Button>Save report</Button>
<Button size="sm">Save report</Button>
<Button size="lg">Save report</Button> Secondary
Section titled “Secondary”Supporting or lower-priority actions.
<Button variant="secondary">Cancel</Button>
<Button variant="secondary" size="sm">Cancel</Button> Danger
Section titled “Danger”Destructive or irreversible actions.
<Button variant="danger">Delete project</Button> Disabled state
Section titled “Disabled state”<Button disabled>Save report</Button>
<Button variant="secondary" disabled>Cancel</Button> Render prop
Section titled “Render prop”Why does this exist? An <a> inside a
<button>
is invalid HTML. Passing a render prop applies button styles to any element — typically a router
Link — so the rendered HTML is a single <a>, not a button
wrapping a link.
// Navigates to a new page → use render prop + Link
<Button>
{(props) => <Link to="/projects/new" {...props}>New project</Link>}
</Button>
// Submits a form → plain button
<Button type="submit">Create project</Button> | Prop | Type | Default | Description |
|---|---|---|---|
variant | ’primary’ | ‘secondary’ | ‘danger' | 'primary’ | Visual style |
size | ’sm’ | ‘md’ | ‘lg' | 'md’ | Button size |
children | ReactNode | (props) => ReactNode | — | Pass a render prop to apply button styles to a custom element instead of a
|
…props | ButtonHTMLAttributes | — | All native button attributes |