Swirski UI

Forms

Switch

A native checkbox presented as a switch for binary preferences and settings.

Component

08

Request Changes

Import

import { Switch } from "@swirski/ui";

Playground

4 controls

Controls

Usage

<Switch
  label="Studio mode"
  description="Use switch semantics without giving up native forms."
  defaultChecked
/>

Props

7 generated
PropTypeDefaultNotes
containerClassNamestring-Adds classes to the root label wrapper.
descriptionReactNode-Optional supporting text below the label.
inputClassNamestring-Generated from SwitchProps.
labelReactNode-Visible label rendered beside the switch.
size'sm' | 'md' | 'lg'"md"Generated from SwitchProps.
tone'blue' | 'yellow' | 'red'"blue"Generated from SwitchProps.
variant'default' | 'card'"default"Generated from SwitchProps.
classNamestring-Adds classes to the hidden native checkbox input.
disabledbooleanfalseDisables interaction and dims the wrapper.
...inputPropsOmit<InputHTMLAttributes<HTMLInputElement>, "type">-Forwarded to the native switch input.
Previous: CheckboxNext: Accordion