---
title: "Switch"
description: "Toggle switch with v-model support. Wraps the Polaris <s-switch> web component."
canonical_url: "https://shopify.yan.ad/components/forms/switch"
---
# Switch

> Toggle switch with v-model support. Wraps the Polaris <s-switch> web component.

## Live preview

<polaris-preview example="switch">



</polaris-preview>

## Props

<table>
<thead>
  <tr>
    <th>
      Prop
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        modelValue
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Bound value (use with <code>
        v-model
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        label
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Switch label
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        defaultChecked
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Default checked (uncontrolled)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        accessibilityLabel
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Accessible label
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        labelAccessibilityVisibility
      </code>
    </td>
    
    <td>
      <code>
        'visible' | 'exclusive'
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Label visibility for assistive tech
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        error
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Error message
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        details
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Help text below the switch
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        required
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Marks the field as required
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        disabled
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Disables the switch
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Element ID
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Form field name
    </td>
  </tr>
</tbody>
</table>

## Events

<table>
<thead>
  <tr>
    <th>
      Event
    </th>
    
    <th>
      Payload
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        update:modelValue
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Emitted when toggled
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        change
      </code>
    </td>
    
    <td>
      <code>
        Event
      </code>
    </td>
    
    <td>
      Native change event
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        input
      </code>
    </td>
    
    <td>
      <code>
        Event
      </code>
    </td>
    
    <td>
      Native input event
    </td>
  </tr>
</tbody>
</table>

## Slots

<table>
<thead>
  <tr>
    <th>
      Slot
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        default
      </code>
    </td>
    
    <td>
      Additional content
    </td>
  </tr>
</tbody>
</table>

## Polaris Element

Renders as `<s-switch>`. See [Polaris Switch docs](https://shopify.dev/docs/api/app-home/web-components/forms/switch).


## Sitemap

See the full [sitemap](https://shopify.yan.ad/sitemap.md) for all pages.
