Buttons demos
Every demo has a standalone page with its preview, source and notes.
21 demos
Components
- Button tones, variants and sizes
Every tone and variant (the contrast matrix), the three sizes, icons, an icon-only button with its name and tooltip, a disabled button, keyboard activation and a link rendered through
render. - Press and hold to repeat
A quantity stepper whose buttons repeat while held, with the default 400 ms delay and a custom delay and interval.
- Button attributes, classes and server rendering
className and style on a Button, DOM attributes passed through to the native button, a handler that vetoes the built-in toggle with preventDefault, and a status that shows the demo was rendered on the server and then hydrated.
- Server rendering cost
Runs React's renderToString in the browser over 100 Buttons and a closed MenuButton with 100 and 1,000 items, showing the time per render and that the closed menu's markup does not grow with its items.
- Toggle buttons
An uncontrolled toggle button and a controlled one whose pressed state the parent owns.
- Button groups
Attached and spaced groups, a vertical group, group styles inherited by the buttons with per-button overrides, and a disabled group.
- Toggle button groups in a form
A radio group and a multiple-selection group that submit their values through hidden inputs, plus a controlled single-selection group.
- Input chips with TagGroup
Removable, selectable tags with Delete / Backspace, an add field, and drag or Alt + arrow reordering between two groups.
Menus
- Menu Button
A MenuButton with JSX items, a link item, a submenu and a labelled group, and a second one built from an
itemsarray with a disabled item and bottom-end placement. - Menu items from data
MenuButtons built from
items- item icons, arenderItemtemplate with counts, a wider popup throughstyles.menu, trigger tone, variant, size and icon, and a custom or hidden open indicator. - Checkable menu items
Controlled MenuCheckboxItem and MenuRadioGroup items in a MenuButton; Space toggles and keeps the menu open.
- Menu open state, keyboard and ARIA
A controlled MenuButton that logs every onOpenChange reason and source, can veto closing on an outside press, and reads back the trigger's ARIA and data attributes and the menu markup in the page.
- Standalone menu and RTL menus
A Menu rendered in place without a button, and a MenuButton with a submenu inside a right-to-left container whose popup and submenu mirror.
- Long menu
A MenuButton with 100 or 1,000 items (menus are not virtualized), showing the time from the open request to the first frame with the menu.
- Split Button
A primary action with a grouped menu of alternatives, a named menu trigger and a styled popup part, and a disabled SplitButton.
- Button groups with menus and RTL
A MenuButton and a SplitButton inside a ButtonGroup, a SplitButton in a vertical group, and a toggle group and a button group inside a right-to-left container.
Recipes
- Loading and progress
A button that shows the progress the application reports, a loading button that keeps focus, a custom progress label and a custom spinner.
- Floating action button
Floating buttons positioned by CSS inside a panel, with pickers for the nine logical positions, tone and variant, a visibility toggle, custom insets and a press-and-hold floating button.
- Choice, filter and action chips
Single-selection choice chips, multiple-selection filter chips with a check mark, and action chips in a spaced button group.
- Chips from data
Filter chips mapped from application data with avatar and trailing content, per-chip tone, class, attributes and disabled state, a group-wide disable, a click veto through the controlled value, and single chips.
- Speed Dial
An icon-only MenuButton in the bottom-end corner that opens its actions above itself (placement top-end).