An icon-only toggle needs an aria-label. Keep the name the same in both states and change only the icon.
bold-toggle.tsx
Toggle
<button>| Prop | Type | Default | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| rounded | "default""full" | "default" | ||||||||||||||||||||||||||||||
| class | string | — | ||||||||||||||||||||||||||||||
| variant | "default""outline" | "default" | default: no rest fill. outline: the field surface with an edge. | |||||||||||||||||||||||||||||
| size | "default""lg""sm""xs" | "default" | Height 24, 28, 32, or 36px. | |||||||||||||||||||||||||||||
From Base UIToggleBase UI docs | ||||||||||||||||||||||||||||||||
| pressed | boolean | — | Whether the toggle button is currently pressed. This is the controlled counterpart of defaultPressed. | |||||||||||||||||||||||||||||
| default | boolean | false | Whether the toggle button is currently pressed. This is the uncontrolled counterpart of pressed. | |||||||||||||||||||||||||||||
| disabled | boolean | false | Whether the component should ignore user interaction. | |||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||
| ...props | <button> attributes | — | Every other attribute goes to the <button>, with a ref. | |||||||||||||||||||||||||||||
| Enter | Turns the toggle on or off. |
|---|---|
| Space | Turns the toggle on or off. |
- Segmented ControlPick one value from a few options in one row. A pill slides to the choice, and the value goes with the form like a radio group.
- ButtonA button for an action on the page, such as Save or Delete. It has 9 looks and 5 sizes, and a spinner that keeps its width while the action runs.
- Animated Eye IconAn eye for Show and Hide buttons. It blinks on hover, and a slash draws across it when the value is hidden.
- Toggle GroupA set of toggles that share one value, such as text alignment. One or many can be on, in a row, a column, or as picture tiles.
- CheckboxPick Checkbox for a choice in a form that a Save or Submit button sends.
- SwitchPick Switch for a named setting in a settings list that takes effect at once.
Built with
Installs with Toggle
- Components
- Button









