Switch · toggle

State: on

Usage

import { signal } from "./index.js";
import { Switch } from "./components/switch.js";

const notifications = signal(true);

// value is a boolean signal it reads + writes; onChange fires after toggle.
Switch({ value: notifications,
         onChange: (v) => toast(v ? "On" : "Off") })