Toggle
UI SDK Toggle: a button that stays pressed, with variants and sizes.
Example
toggle-demo.tsxCopy code
Installation
Copy code
Brings alongtooltip
npm packages
class-variance-authority@0.7.1Usage
ImportCopy code
API reference
Toggle
| Prop | Type | Default |
|---|---|---|
variant | "default" | "outline" | "default" |
tooltipAn icon toggle shows its `aria-label` in a tooltip; `false` turns it off, text or `{ content, side }` replaces it. | ControlTooltipOption | – |
size | "sm" | "default" | "lg" | "icon" | – |
aria-label | string | – |
Also takes every prop of UI SDK Toggle except aria-label.
ToggleIcon
Other exports
createToggleControllertoggleVariantstype TogglePropstype ToggleControllertype TogglePressedChangeReasontype ToggleStateAccessibility
- A button that stays pressed, with aria-pressed. Pressed is a full primary fill for 3:1.
Agent actions
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.