Skip to content

Toggle

Free

A button that stays on or off, such as Bold, Mute, or Pin. It has two looks, four sizes, and the same shape as Button.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 8, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

An icon-only toggle needs an aria-label. Keep the name the same in both states and change only the icon.

bold-toggle.tsx

Toggle

<button>
PropTypeDefaultDescription
rounded"default""full""default"
classNamestring—
variant"default""outline""default"default: no rest fill. outline: the field surface with an edge.
size"default""lg""sm""xs""default"Height 24, 28, 32, or 36px.
From Base UIToggleBase UI docs
pressedboolean—Whether the toggle button is currently pressed. This is the controlled counterpart of defaultPressed.
defaultPressedbooleanfalseWhether the toggle button is currently pressed. This is the uncontrolled counterpart of pressed.
disabledbooleanfalseWhether the component should ignore user interaction.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.
  • Use it for a button that stays on or off and acts at once.
  • Use variant="outline" to sit level with a field.
  • Use pressed and onPressedChange to control it, or defaultPressed to leave it on its own.
EnterTurns the toggle on or off.
SpaceTurns the toggle on or off.

It is a Base UI Toggle: a button with aria-pressed.

It has no form value. Use a Switch or a Checkbox in a form.

hit-area grows the target to 44 × 44. For toggles closer than 16px, put hit-area-row on the row.

Built with

Installs with Toggle

Components
Button
  1. AddedToggle, with Button.
Open the release