Skip to content

Component · <input type="checkbox" role="switch">

Switch

An on/off toggle. A native checkbox with role switch.

Install

npx @lazizbekio/mitame add switch

Usage

import { Switch } from "@/components/mitame/ui/switch";

export default function SwitchDemo() {
  return (
    <div className="flex flex-col gap-3">
      <Switch defaultChecked>Notifications</Switch>
      <Switch>Dark wallpaper</Switch>
    </div>
  );
}

Props

PropTypeDefaultDescription
childrenReactNode—The label.
...propsInputHTMLAttributes—checked, defaultChecked, onChange, name, disabled…

Keyboard

KeyDoes
SpaceToggle

Styling

Every part has a data-slot starting with switch, and state lives in data-state,data-variant and friends. Pass any class to override; theme styles sit in a lower CSS layer, so yours win. See Theming.