Button
Buttons for actions, with icon buttons, attached groups and a split button that opens related actions.
Example
<Button variant="primary" loading={saving} onClick={save}>Save view</Button>
<Button variant="signal">Apply filter</Button>
<Button>Export</Button>
<Button variant="ghost">Cancel</Button>
<Button variant="destructive">Delete</Button>
<IconButton icon={<IconDownload />} label="Download" />
<ButtonGroup aria-label="View">
{['Chart', 'Table', 'Both'].map((v) => (
<Button key={v} aria-pressed={view === v} onClick={() => setView(v)}>{v}</Button>
))}
</ButtonGroup>
<SplitButton
variant="signal"
label="Export PDF"
menuLabel="More export formats"
onClick={exportPdf}
menu={[
{ label: 'Export CSV', icon: <IconFile />, meta: '.csv', onSelect: exportCsv },
{ label: 'Share link', icon: <IconShare />, onSelect: share },
]}
/>Usage
Use primary (ink) for the one main action in a view and signal for actions that change what the data shows, such as applying a filter. secondary is the default. Sizes are 28, 36 and 44 px at comfortable density.
loading shows a spinner, keeps the width and blocks clicks. SplitButton disables its chevron while loading too. Buttons spread native button attributes, and default to type="button".
Props
Button
primary (ink) is the one primary action per view. signal is for actions that change what the data shows: apply, select, share a view.ButtonGroup, defaults to the group's size.Also accepts the props of ButtonHTMLAttributes<HTMLButtonElement>, spread onto the root element.
IconButton
aria-label).primary (ink) is the one primary action per view. signal is for actions that change what the data shows: apply, select, share a view.ButtonGroup, defaults to the group's size.Also accepts the props of Omit<ButtonProps, 'children' | 'iconEnd' | 'aria-label'>, spread onto the root element.
ButtonGroup
size still wins).aria-pressed="true" renders as the selected one, so the group works as a toggle set.Also accepts the props of HTMLAttributes<HTMLDivElement>, spread onto the root element.
SplitButton
role="menu" list) or any custom content for the popover.SplitButtonItem
Accessibility
- Native
buttonelements with a visible focus ring. IconButtonrequireslabel, which becomes itsaria-label.- In a ButtonGroup used as a toggle, set
aria-pressedon each button; the pressed one is styled from it. - SplitButton's chevron is a separate button named by
menuLabel, opening arole="menu"list.