Jone

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:

Anatomy
import { Toggle } from '@base-ui/react/toggle';

<Toggle />;

API reference

Root

NameTypeDefaultDescription
pressedOptionalboolean | undefinedWhether the toggle button is currently pressed. This is the controlled counterpart of `defaultPressed`.
defaultPressedOptionalboolean | undefinedfalseWhether the toggle button is currently pressed. This is the uncontrolled counterpart of `pressed`.
disabledOptionalboolean | undefinedfalseWhether the component should ignore user interaction.
valueOptionalValue | undefinedA unique string that identifies the toggle when used inside a toggle group.

On this page