Toggle
Two-state pressed button.
Installation
Usage
Examples
Variants
Default and outline styles.
Sizes
Small, default, and large.
Disabled
Disabled toggles ignore interaction.
API reference
Toggle
| Prop | Type | Default |
|---|---|---|
variantVisual style. | "default" | "outline" | "default" |
sizeSize. | "default" | "sm" | "lg" | "default" |
pressedControlled pressed state. Use with onPressedChange. | boolean | - |
defaultPressedInitially pressed when uncontrolled. | boolean | false |
onPressedChangeCalled when the pressed state changes. | (pressed: boolean) => void | - |
disabledDisable interaction. Renders at half opacity. | boolean | false |
renderPolymorphic render prop. | ReactElement | ((props) => ReactNode) | - |
nativeButtonSet explicitly to override the automatic inference. Inferred from the render element unless told otherwise. | boolean | - |
classNameAdditional classes merged with the variant styles. | string | - |