Components
Toggle switch

Toggle switch

Toggle switch is used to immediately toggle a setting on or off.

Enable

Disable

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
PropTypeDefaultRequired
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.
Note: Avoid adding a label behind to describe the status of a toggle, this is redundant and confuses the interface.