Toggle
A high-quality, unstyled React toggle component that displays a two-state button that can be on or off.
A two-state button that can be on or off.
Anatomy
Import the component and use it as a single part:
import { Toggle } from '@base-ui/react/toggle';
<Toggle />;API reference
Root
| Name | Type | Default | Description |
|---|---|---|---|
pressedOptional | boolean | undefined | — | Whether the toggle button is currently pressed. This is the controlled counterpart of `defaultPressed`. |
defaultPressedOptional | boolean | undefined | false | Whether the toggle button is currently pressed. This is the uncontrolled counterpart of `pressed`. |
disabledOptional | boolean | undefined | false | Whether the component should ignore user interaction. |
valueOptional | Value | undefined | — | A unique string that identifies the toggle when used inside a toggle group. |