Selection and input

Switch

An on/off setting, tinted with your accent.

iOSSwiftUI ToggleAndroidCompose SwitchRenders in a Screen or an Island
iOSSwiftUI Toggle
AndroidCompose Switch

Import

ts
import {Switch} from '@hzblj/kara-ui'

Props

SwiftUI Toggle / Compose Switch, tinted fill.accent.primary.

PropTypeDefaultDescription
value*boolean—

Whether it is on. Controlled: pass back what onValueChange reports.

disabledbooleanfalse

Stops the user flipping it, and dims it.

labelstring—

Shown beside the switch. On Android it makes a full-width row — label at the start, switch at the end — that toggles wherever it is tapped.

onValueChange(value: boolean) => void—

Called with the new value when the user flips it. On Android a flip plays toggleOn / toggleOff.

value*
boolean

Whether it is on. Controlled: pass back what onValueChange reports.

disabledfalse
boolean

Stops the user flipping it, and dims it.

label
string

Shown beside the switch. On Android it makes a full-width row — label at the start, switch at the end — that toggles wherever it is tapped.

onValueChange
(value: boolean) => void

Called with the new value when the user flips it. On Android a flip plays toggleOn / toggleOff.

Platform notes

  • With a label, the whole row toggles.
  • Android plays toggleOn / toggleOff, which Compose’s switch does not; iOS’s own switch keeps its own feedback.