ToggleButton
A button with an on/off state, or one option of an exclusive group that behaves like radio (without a form).
Independent
<ToggleButton>Bold</ToggleButton>
<ToggleButton>Italic</ToggleButton>Exclusive group
<ToggleButton exclusiveGroup="range">Day</ToggleButton>
<ToggleButton exclusiveGroup="range" pressed>Week</ToggleButton>
<ToggleButton exclusiveGroup="range">Month</ToggleButton>Props
| Prop | Type | Default | Description |
|---|---|---|---|
pressed | boolean | false | Initial on state. |
exclusiveGroup | string | - | One on at a time within the same group name. |
variant / size | secondary | ghost / sm | md | lg | secondary / md | Button styling. |
Events
document.addEventListener("ink:toggle:change", (event) => {
console.log(event.target.textContent);
});Accessibility
- State lives in
aria-pressed: real buttons, keyboard free. - Exclusive groups mirror radio semantics; for form submission prefer
RadioGroup.