Actions
Toggle
Switches a command or formatting option on and off.
idle
Usage
Examples
Document tools
Toggle formatting and pin actions independently.
Managed action
Disabled toggles retain their selected or unselected appearance.
Control sizes
Text and icon toggles share the same small, default, and large heights.
Controlled state
Keep the pressed state in application state and announce the result.
Recommendations
| Guidance | Practice |
|---|---|
| Do | Name the option being enabled. Keep its label stable between pressed and unpressed states. |
Usage boundaries
| Guidance | Boundary |
|---|---|
| Scope | Use Button for a one-time action. Use Switch for an immediate setting with explicit on/off meaning. |
API reference
Public props from @mizen-labs/ui. Use exported prop types for the complete TypeScript contract.
| Prop | Type | Default | Description |
|---|---|---|---|
| | — | A single pressed state; icon-only sizes require aria-label or aria-labelledby. |
| | "default" | Selects a text or icon size. |
| | "default" | Selects default or outline treatment. |
| | false | Controls a single toggle's pressed state. |
| | false | Sets its initial pressed state. |
| | false | Disables native activation and keeps the selected appearance visible. |
| | — | Receives the next boolean state. Cancel the event details to veto the change. |