ObjectUIObjectUI

Switch

Toggle switch for binary options

Examples

Basic Switch

{
  "type": "switch",
  "label": "Enable notifications"
}

Multiple Switches

{
  "type": "stack",
  "gap": 3,
  "children": [
    {
      "type": "switch",
      "label": "Email notifications"
    },
    {
      "type": "switch",
      "label": "Push notifications"
    },
    {
      "type": "switch",
      "label": "SMS notifications"
    }
  ]
}

Schema

interface SwitchSchema {
  type: 'switch';
  name?: string;
  label?: string;
  defaultChecked?: boolean;
  disabled?: boolean;
}

On this page