Skip to content

Switch / toggle

In review
Live · web

Settings rows: label + control (the control is its own target)

Push notificationsAlerts when a session needs you
Haptic feedbackVibrate on button confirms
Enable thinkingLocked by your administrator
Parallel tool callsSaving your preference…

States: tab in, toggle with Space / Enter

OffOnDisabled offDisabled onLoading

Sizes & inline use

SmallMediumStream tokens

Toggled 0 times. The island is live.

// Web: React, consuming @dizyx/nockerl-tokens. (Web is the laggard platform;
// this is the canonical API the published @dizyx/nockerl-react package exposes.
// NockerlSwitch ships in the package; see the drift note for the per-platform status.)
import { NockerlSwitch } from '@dizyx/nockerl-react';
export function SettingsRows() {
const [push, setPush] = useState(true);
const [haptics, setHaptics] = useState(false);
return (
<>
<NockerlSwitch label="Push notifications" checked={push} onChange={setPush} />
<NockerlSwitch label="Haptic feedback" checked={haptics} onChange={setHaptics} />
<NockerlSwitch label="Parallel tool calls" checked={false} loading />
<NockerlSwitch label="Enable thinking" checked disabled />
</>
);
}
PropTypeDefaultDescription
checked *booleanControlled checked state.
onChange(next: boolean) => voidFired with the next checked value. Ignored while disabled or loading.
labelstringAccessible name. Rendered as a persistent label when label is set, else required.
descriptionstringSupporting line under the label (label rows only).
sizeNockerlSwitchSize'md'Track + thumb scale. md matches the Material/system default.
disabledbooleanfalseInert + clearly-seen (never invisible) state.
loadingbooleanfalseAwaiting async confirmation. Shows a spinner in the thumb and blocks re-toggle.
ariaLabelstringaria-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.