Button
Starts an action. Use a link, not a button, to go to another page.
import { Button, buttonStyles } from '@/design-system';Examples
Variants
Use one primary button for the main action in a group.
import { Button } from '@/design-system';
export default function ButtonVariants() {
return (
<div className="flex flex-wrap items-center gap-3">
<Button>Primary</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="link">Link</Button>
<Button disabled>Disabled</Button>
</div>
);
}Full width
import { Button } from '@/design-system';
export default function ButtonBlock() {
return (
<Button block type="submit">
Send
</Button>
);
}Links styled as buttons
buttonStyles() returns the classes, so a link keeps being a link.
import { buttonStyles } from '@/design-system';
export default function ButtonLink() {
return (
<a href="#main" className={buttonStyles({ variant: 'secondary' })}>
A link that looks like a button
</a>
);
}How it works
- The default
typeisbutton, so a button inside a form does not submit it by accident. - A disabled button is faded and shows a not-allowed cursor.
Props
Button
Every other button attribute is passed through.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'primary' | 'secondary' | 'link' | 'primary' | How strong the button looks. A link button reads as a link in running text. |
block | boolean | false | Fills the width of its container. |
type | 'button' | 'submit' | 'reset' | 'button' | Set to submit for the button that sends a form. |
className | string | — | Extra classes, for spacing or width. Utility classes override the component’s own styles. |
buttonStyles
Takes one optional object and returns a class string.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'primary' | 'secondary' | 'link' | 'primary' | As above. |
block | boolean | false | As above. |
className | string | — | Extra classes, for spacing or width. Utility classes override the component’s own styles. |
Tokens
| Token | Default | Sets |
|---|---|---|
--button-radius | --radius-control | Corner radius |
--button-padding-x | 1rem | Side padding |
--button-padding-y | 0.5rem | Top and bottom padding |
--button-font-size | 0.875rem | Text size |
--button-line-height | 1.25rem | Line height |
--button-font-weight | 500 | Text weight |
--button-primary-background | --accent | Primary fill |
--button-primary-border | transparent | Primary border |
--button-primary-text | --on-accent | Primary text |
--button-primary-shadow | a small shadow | Primary shadow |
--button-secondary-background | --surface | Secondary fill |
--button-secondary-border | --border | Secondary border |
--button-secondary-text | --foreground | Secondary text |
--button-secondary-hover-background | unchanged | Secondary fill on hover |
--button-secondary-hover-border | --accent | Secondary border on hover |