Components
IconButton
A square icon-only button with a required accessible name and token-based sizes.
IconButton is a square, icon-only variant of Button. The label prop is
required and becomes the button's accessible name, so the icon never carries meaning on its own.
Use it for compact actions such as add, edit, settings, or delete. For buttons with visible text, use
Button.
Live preview#
import { IconButton, Stack } from '@orkest/ui';
import { Plus, Settings, Trash2 } from 'lucide-react';
export function Example() {
return (
<Stack direction="row" gap={2} wrap>
<IconButton icon={Plus} label="Add item" />
<IconButton icon={Settings} label="Settings" variant="outline" />
<IconButton icon={Trash2} label="Delete" variant="destructive" />
</Stack>
);
}Sizes#
import { IconButton, Stack } from '@orkest/ui';
import { Plus } from 'lucide-react';
export function Example() {
return (
<Stack direction="row" gap={2} align="center" wrap>
<IconButton icon={Plus} label="Add item" size="sm" />
<IconButton icon={Plus} label="Add item" size="md" />
<IconButton icon={Plus} label="Add item" size="lg" />
<IconButton icon={Plus} label="Add item" size="xl" />
</Stack>
);
}States#
import { IconButton, Stack } from '@orkest/ui';
import { Settings } from 'lucide-react';
export function Example() {
return (
<Stack direction="row" gap={2} align="center" wrap>
<IconButton icon={Settings} label="Settings" disabled />
<IconButton icon={Settings} label="Loading settings" loading />
</Stack>
);
}Props#
| Prop | Type | Default |
|---|---|---|
icon | LucideIcon | — |
| Required. Icon rendered inside the button. It is hidden from assistive technology. | ||
label | string | — |
| Required. Accessible name applied as aria-label. | ||
variant | 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive' | 'link' | 'primary' |
| Visual treatment inherited from Button. | ||
size | 'sm' | 'md' | 'lg' | 'xl' | 'md' |
| Square control size. Width and height always match. | ||
loading | boolean | false |
| Disables the button, sets aria-busy, and replaces the icon with a spinner. | ||
type | 'button' | 'submit' | 'reset' | 'button' |
| Native button type. The default prevents accidental form submission. | ||
native attributes | ButtonHTMLAttributes<HTMLButtonElement> | — |
| Disabled, name, value, form, event handlers, ARIA, and ref are forwarded. | ||
Accessibility#
labelis required and becomes the accessible name. Never rely on the icon alone.- The icon is decorative and hidden from assistive technology.
- The component renders a native
<button>withtype="button"by default. - Loading sets the native disabled state and
aria-busy="true", matchingButton. - Focus-visible and disabled styles use the same tokens and behavior as
Button. - For navigation, use a link element with an accessible name instead of
IconButton.