---
title: Switch
description: JSON Schema for the Switch component.
---

Toggle switch component.

```json
{
  "type": "object",
  "properties": {
    "type": {
      "const": "Switch",
      "default": "Switch",
      "type": "string"
    },
    "id": {
      "type": [
        "string",
        "null"
      ],
      "default": null,
      "description": "HTML id attribute for CSS targeting. Applied to the outermost element."
    },
    "cssClass": {
      "type": [
        "string",
        "null"
      ],
      "default": null,
      "description": "CSS/Tailwind classes for styling. Accepts a Responsive() for breakpoint-aware classes."
    },
    "name": {
      "type": [
        "string",
        "null"
      ],
      "default": null,
      "description": "State key for reactive binding. Auto-generated if omitted."
    },
    "label": {
      "type": [
        "string",
        "null"
      ],
      "default": null,
      "description": "Label text"
    },
    "checked": {
      "default": false,
      "description": "Whether switch is on",
      "type": "boolean"
    },
    "size": {
      "default": "default",
      "description": "Switch size (sm, default)",
      "enum": [
        "sm",
        "default"
      ],
      "type": "string"
    },
    "disabled": {
      "default": false,
      "description": "Whether switch is disabled",
      "type": "boolean"
    },
    "required": {
      "default": false,
      "description": "Whether switch is required",
      "type": "boolean"
    },
    "onChange": {
      "$ref": "Action",
      "description": "Action(s) to execute when toggled",
      "default": null
    }
  },
  "required": [
    "type"
  ]
}
```
