Switch

Components

Switch

A compact binary setting whose effect is immediate rather than deferred to a form submission.

Immediate setting

The visible label names the state being controlled. Use Checkbox when the choice belongs to a group that is submitted together.

tsx
import { Switch } from "@karnstack/dowel";

<label>
  <Switch name="mirror" defaultChecked />
  Mirror native repository to GitHub
</label>

States

tsx
<label><Switch /> Off</label>
<label><Switch defaultChecked /> On</label>
<label><Switch disabled /> Unavailable</label>

Behavior

Space toggles the focused switch. Controlled and uncontrolled state use checked, defaultChecked, and onCheckedChange. The hidden input preserves native form submission.