Toggle native
A two-state button that stays pressed.
Preview
Loading the renderer…
createSurface + updateComponents, A2UI v0.9.
json
[
{
"version": "v0.9",
"createSurface": {
"surfaceId": "preview",
"catalogId": "https://ui.exponential.at/catalogs/core/v1"
}
},
{
"version": "v0.9",
"updateComponents": {
"surfaceId": "preview",
"components": [
{
"id": "root",
"component": "Stack",
"direction": "vertical",
"align": "start",
"children": [
"example"
]
},
{
"id": "example",
"component": "Toggle",
"label": "Bold",
"icon": "editor-bold",
"pressed": false
}
]
}
}
]This surface through a MemoryTransport. Install and transports: React guide.
This surface through a MemoryTransport. Install and transports: SwiftUI guide.
This surface through a MemoryTransport. Install and transports: Compose guide.
This surface through a MemoryTransport. Install and transports: gpui guide.
Platforms




View exponential-ui-toggle, painted by each native renderer.
Variants
pressedvariant · defaultvariant · outlinesize · smsize · defaultsize · lgProps
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | string | – | The button text or accessibility label. |
icon | icon | – | An icon before or instead of the label. |
pressedbind | boolean | false | The state; bind it. |
variant | default | outline | "default" | Plain or outlined. |
size | sm | default | lg | "default" | Control height class. |
Events and slots
| Name | Kind |
|---|---|
on.change | event: runs an action |
Accessibility
- Role
button- Semantics
- button with aria-pressed
| Keys | Action |
|---|---|
| EnterSpace | toggle |
Theming
- Recipe parts
Toggle/rootToggle/iconToggle/label- Keyed by
variantsizepressed:hover:pressed:focus:disabled:checked:open:selected:invalid:dragover