Night
Paper / black
The grid stays. Only the ink inverts.
Turns one setting on or off. 32×18px; on fills with ink, off uses a 1px track.
Paper / black
The grid stays. Only the ink inverts.
Three ways in. They share one source, so the pixels match whichever you pick.
npm install @noorddev/vlak-react
// once, next to your app's root
import "@noorddev/vlak-react/css";
import { Switch } from "@noorddev/vlak-react";Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/switch.
npx @noorddev/vlak-cli add switch
The StyleX leaf lands in components/vlak/, for your own compiler to own. See StyleX.
npx shadcn add https://vlak.dev/r/switch.json
The same registry item, installed by shadcn's CLI.
<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />
No React. Link vlak.css and use the markup and classes below.
import { useState } from "react";
import { Switch } from "@noorddev/vlak-react";
const [enabled, setEnabled] = useState(false);
<Switch checked={enabled} onCheckedChange={setEnabled} aria-label="Notifications" />A button with role="switch".
| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | ||
defaultChecked | boolean | ||
onCheckedChange | (checked: boolean) => void |
Also accepts Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onChange">.
| Keys | Does |
|---|---|
| Tab | Moves focus to the switch |
| Space, Enter | Toggles it |
<span class="rs-switch rs-switch-on"><i></i></span>