Components
Button
Trigger actions with token-driven variants, sizes, icons, and loading feedback.
Button renders a native <button> with a small set of visual variants, four sizes, optional icons,
and a loading state. It defaults to type="button" so it does not submit a form accidentally.
Use Button for actions. For navigation, render a link element instead. For icon-only actions, use
IconButton which requires an accessible name.
Live preview#
import { Button } from '@orkest/ui';
export function Example() {
return <Button>Save changes</Button>;
}Variants#
import { Button, Stack } from '@orkest/ui';
export function Example() {
return (
<Stack direction="row" gap={2} wrap>
<Button>Primary</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="outline">Outline</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="destructive">Destructive</Button>
<Button variant="link">Link</Button>
</Stack>
);
}The link variant is visual only
variant="link" renders a button that looks like a link. It keeps button semantics. Use an anchor
element when the interaction navigates to another URL.
Sizes#
import { Button, Stack } from '@orkest/ui';
export function Example() {
return (
<Stack direction="row" gap={2} align="center" wrap>
<Button size="sm">Small</Button>
<Button size="md">Medium</Button>
<Button size="lg">Large</Button>
<Button size="xl">Extra large</Button>
</Stack>
);
}Icons#
Icons are decorative because the button label supplies the accessible name. The icon size follows the button size.
import { Button, Stack } from '@orkest/ui';
import { ArrowRight, Plus } from 'lucide-react';
export function Example() {
return (
<Stack direction="row" gap={2} align="center" wrap>
<Button leftIcon={Plus}>New project</Button>
<Button variant="secondary" rightIcon={ArrowRight}>
Continue
</Button>
<Button iconOnly leftIcon={Plus} aria-label="Add item" />
</Stack>
);
}Prefer IconButton for icon-only actions; its label prop is
required and becomes the accessible name.
States#
import { Button, Stack } from '@orkest/ui';
export function Example() {
return (
<Stack direction="row" gap={2} align="center" wrap>
<Button disabled>Disabled</Button>
<Button loading>Saving</Button>
<Button variant="outline" loading>
Publishing
</Button>
</Stack>
);
}loading sets the native disabled attribute, exposes aria-busy="true", and replaces the leading
icon with a spinner. This blocks repeated submissions but also removes the button from the tab order
until loading completes.
Full width#
import { Box, Button } from '@orkest/ui';
export function Example() {
return (
<Box style={{ width: '18rem' }}>
<Button fullWidth>Continue</Button>
</Box>
);
}Props#
| Prop | Type | Default |
|---|---|---|
variant | 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive' | 'link' | 'primary' |
| Visual treatment. The link variant changes appearance only. | ||
size | 'sm' | 'md' | 'lg' | 'xl' | 'md' |
| Control height, padding, radius, and label size. | ||
leftIcon | LucideIcon | — |
| Decorative icon rendered before the label. | ||
rightIcon | LucideIcon | — |
| Decorative icon rendered after the label. Hidden while loading. | ||
loading | boolean | false |
| Disables the button, sets aria-busy, and renders a spinner. | ||
fullWidth | boolean | false |
| Stretches the button to the width of its container. | ||
iconOnly | boolean | false |
| Renders a square icon-only button. Provide an accessible name with aria-label or use IconButton. | ||
type | 'button' | 'submit' | 'reset' | 'button' |
| Native button type. The default prevents accidental form submission. | ||
children | ReactNode | — |
| Button label. Required unless iconOnly is combined with an icon. | ||
native attributes | ButtonHTMLAttributes<HTMLButtonElement> | — |
| Disabled, name, value, form, event handlers, ARIA, and ref are forwarded. | ||
Accessibility#
Buttonrenders a native<button>, so Enter and Space activate it.- The default
typeisbutton. Settype="submit"explicitly for form submission. - Loading buttons are natively disabled and announce
aria-busy. The label remains available to assistive technology. - Leading and trailing icons are hidden from assistive technology. The label supplies the accessible name.
iconOnlyrequires anaria-label. PreferIconButton, whoselabelprop is required.- The focus-visible ring uses the shared focus tokens and is not removed.
- Disabled buttons rely on the native disabled state and a muted token surface, not color alone.
- The link variant does not change semantics; use an anchor for navigation.
Related#
- IconButton for icon-only actions with a required label.
- Icon for the icon primitive used by buttons.
- Colors for action and state tokens.