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 />
PropTypeDefault
aria-labelstringundefined
aria-labelledbystringundefined
classNamestring | (state) => stringundefined
defaultPressedbooleanfalse
disabledbooleanfalse
onPressedChangefunction(pressed: boolean, event: Event) => voidundefined
pressedbooleanundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
valuestringundefined
Attribute
Description
data-pressed