Installation
Usage
Props
Controlled pressed state.
Default pressed state.
Callback when state changes:
(pressed: boolean) => voidVisual variant.Options:
default, outlineSize of the toggle.Options:
sm, md, lg, iconDisable the toggle.
Variants
- default: Transparent border
- outline: Visible border
Sizes
sm: h-8, text-smmd: h-9 (default)lg: h-10icon: size-9 (square)
Examples
Basic Toggle
With Icons
Variants
Sizes
Controlled
Toggle Group (Text Formatting)
Accessibility
- Built on @base-ui/react for ARIA support
- Keyboard accessible
- Proper aria-pressed state
- Focus visible ring
- Disabled state prevents interaction