Components/Misc/Switch

Switch

Misc

Toggle switch for binary on / off settings.

Hard-edge toggle switch built on Radix Switch. Transitions from bg-bg-elevated (off) to Neo Green (on). Accepts an optional label prop rendered to the right.

Usage

import { Switch } from "nosible-ux"

export default function Example() {
  return <Switch label="Enable real-time alerts" />
}

Examples

With labels

Controlled

Accessibility

Built on Radix Switch: role="switch", aria-checked state, and keyboard activation (Space/Enter) are handled. When label is provided it is linked via htmlFor.

Props

Name TypeDefaultDescription
asChild
boolean | undefined
checked
boolean | undefined
defaultChecked
boolean | undefined
label
ReactNodeOptional visible label rendered to the right of the switch.
onCheckedChange
((checked: boolean) => void) | undefined
required
boolean | undefined