Toggle
A two-state button that can be on or off.
API reference
Import the component and use it as a single part:
Anatomy
import { Toggle } from '@base-ui-components/react/toggle';
<Toggle />
Prop | Type | Default | |
---|---|---|---|
aria-label | string | undefined | |
aria-labelledby | string | undefined | |
className | string | (state) => string | undefined | |
defaultPressed | boolean | false | |
disabled | boolean | false | |
onPressedChange | function(pressed: boolean, event: Event) => void | undefined | |
pressed | boolean | undefined | |
render | | React.ReactElement | undefined | |
value | string | undefined |
Attribute | Description | |
---|---|---|
data-pressed | Present when the toggle button is pressed. |