Murasaki
Components

Switch

A control that allows the user to toggle between checked and not checked.

Usage

import { Switch } from "@murasakijs/ui";
<Switch id="airplane-mode" />

API Reference

Props

PropTypeDefault
checkedboolean—
defaultCheckedboolean—
onCheckedChange(checked: boolean) => void—
disabledbooleanfalse
requiredbooleanfalse
namestring—
valuestring"on"

Switch maps the familiar checked API to React Aria's accessible switch state and interaction model.

Improve this page on GitHub

On this page