Toggle switch
Toggle switch is used to immediately toggle a setting on or off.
Usage
import { Switch } from "@momo-webplatform/mobase";
API Reference
Switch
component extends Radix Switch (opens in a new tab) component and supports all of its props.
Switch
Prop | Type | Default | Required |
defaultChecked | enumboolean | -- | false |
asChild | enumboolean | -- | false |
checked | enumboolean | -- | false |
required | enumboolean | -- | false |
onCheckedChange | (checked: boolean) => void | -- | false |
Best practices
- Use a toggle to instantly turn a component's feature on or off.
- Although similar to checkboxes in terms of on/off functionality, toggle makes changes immediately without the need for additional confirmation steps.