Skip to content

Switch

A labelled on/off switch; bind checked.

Group: Inputs · Kind: native · in the lite catalog

example
disabled · true

Open in the playground

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

exponential-ui-switch on Web
exponential-ui-switch on iOS
exponential-ui-switch on Android
exponential-ui-switch on Desktop
Prop Type Required Bindable Description
label string yes yes The text beside the switch.
name string yes – The field’s key in the submitted data.
checked boolean – yes The state; bind it. Default false.
description string – – A muted line under the label.
disabled boolean – – Shows it inert. Default false.
  • on.change: runs an action

None.

none

No basic catalog component maps here.

A native component: every renderer paints it directly.

Role: switch

switch; the label (and description) first, the switch at the end; the whole row toggles

Keys Action
Space Enter toggle

Recipe parts: Switch/root Switch/track Switch/thumb Switch/label Switch/description Switch/body

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

Themes · Write a theme

Form · FieldGroup · FormActions · Input · Textarea · NumberField · Checkbox · Radio