Fired with the next checked value. Ignored while disabled or loading.
label
string
n/a
Accessible name. Rendered as a persistent label when label is set, else required.
description
string
n/a
Supporting line under the label (label rows only).
size
NockerlSwitchSize
'md'
Track + thumb scale. md matches the Material/system default.
disabled
boolean
false
Inert + clearly-seen (never invisible) state.
loading
boolean
false
Awaiting async confirmation. Shows a spinner in the thumb and blocks re-toggle.
ariaLabel
string
n/a
aria-label when there is no visible label (icon-only / inline use).
Also accepts the native <button> attributes (e.g. onClick, disabled, id, aria-*, data-*), forwarded straight through, plus a forwarded ref.
Parameter
Type
Default
Description
checked *
Boolean
n/a
Whether the switch is on.
onCheckedChange *
((Boolean) -> Unit)?
n/a
Invoked with the new value. Pass null to render a read-only switch.
modifier
Modifier
Modifier
External modifier. The switch is usually the trailingContent of a NockerlSettingsRow.
enabled
Boolean
true
When false, the switch dims (alpha) and stops responding.
colors
SwitchColors
SwitchDefaults.colors()
Brand override: checkedTrackColor = accentPrimary so the ON track is the cyan anchor.
thumbContent
(@Composable -> Unit)?
null
Optional glyph inside the thumb (e.g. a check when on).
NockerlToggleStyle draws the ratified switch on the native Toggle
(which keeps the switch role, value, and keyboard toggling). NockerlToggle is
the convenience wrapper. Loading is web-only for now (async settings confirm has
no native case yet).
Parameter
Type
Default
Description
.toggleStyle(.nockerl)
ToggleStyle
n/a
The ratified switch: recessed-well OFF track, static cyan gradient ON layer (opacity cross-fade, so the fill never hard-cuts), lifted sliding thumb, press squash.
size
NockerlToggleSize
.md
.md 44×26 / 20pt thumb (the system scale) · .sm 36×22 / 16pt, via .nockerl(size: .sm).
NockerlToggle(_:isOn:size:accessibilityLabel:)
View
n/a
Wrapper: labeled row, or the BARE control when the label is nil (labelsHidden + your accessibilityLabel; the host row carries the text).
.disabled(_:)
modifier
n/a
OFF dims the whole control to 55% (clearly seen, never invisible); ON halves the cyan layer and drops the thumb lift; those are the canon’s two disabled reads.
reduced motion
behavior
n/a
Slide + cross-fade jump straight to the end state under accessibilityReduceMotion.
Cross-platform drift (tracked for reconciliation)
Track shape: web draws a recessed well that lifts to a static
cyan gradient; Compose + SwiftUI use the stock platform track (only the ON
color is themed). The catch-light / inset-well treatment is still owed a
custom Compose track.
Loading: only web models a loading state (async settings write). Compose
and SwiftUI gate this at the call site (no in-thumb spinner).