Toggle

A two-state button.

Installation

  1. Add the registryOnce per project
  2. Add toggle

Usage

Use a toggle for one on/off setting, such as muting a call. Keep its label the same in both states; screen readers already announce whether it's pressed.

For a set of related toggles, use a Toggle Group. Inside a Toolbar, use ToolbarToggle.

Examples

Sizes

Give an icon-only toggle an aria-label.

Controlled

Use defaultPressed, or pressed with onPressedChange to control it.

Your microphone is on

Disabled

Props

The tables leave out className, style and render. Parts built on Base UI take them as its styling and composition guides describe.

Toggle