Skip to content

Toggle

A two-state button that stays pressed.

Group: Actions · Kind: native

example
variant · default
variant · outline
size · sm
size · default
size · lg
pressed · true

Open in the playground

The same specimen painted by React, SwiftUI, Compose and gpui.

exponential-ui-toggle on Web
exponential-ui-toggle on iOS
exponential-ui-toggle on Android
exponential-ui-toggle on Desktop
Prop Type Required Bindable Description
label string yes – The button text or accessibility label.
icon icon – – An icon before or instead of the label.
pressed boolean – yes The state; bind it. Default false.
variant default | outline – – Plain or outlined. Default "default".
size sm | default | lg – – Control height class. Default "default".
  • on.change: runs an action

None.

none

No basic catalog component maps here.

A native component: every renderer paints it directly.

Role: button

button with aria-pressed

Keys Action
Enter Space toggle

Recipe parts: Toggle/root Toggle/icon Toggle/label

Keyed by: variant size pressed :hover :pressed :focus :disabled :checked :open :selected :invalid :dragover

Themes · Write a theme

Button · Link