HTML Attributes

HTML switch attribute

Build a form with the HTML form generator

Requests a switch-style presentation for a checkbox in supporting browsers. Its checkbox state and form submission remain the underlying behavior. Use a visible label and test browser support. Applicable elements include: <input>. Check each element’s value rules. Boolean syntax: presence enables the state; omit the attribute to disable it. A string value of "false" does not turn it off.

Formal Syntax & Structure

html syntaxhtml
switch

Parameters & Attributes

NameTypeDescription
switchbooleanRequests a switch-style presentation for a checkbox in supporting browsers. Its checkbox state and form submission remain the underlying behavior. Use a visible label and test browser support.

Working Example

Example Snippethtml
<label>  <input type="checkbox" switch>  Notifications</label>

Browser Compatibility

Minimum supported versions across modern rendering engines

Chrome
Not supported in checked snapshot
No
Firefox
Not supported in checked snapshot
No
Safari
17.4
Yes
Checked desktop BCD snapshot: experimental switch on checkbox. Versions denote the recorded start of support (≤ means at least that early), not a guarantee of all behavior. Unresolved mirror and preview rows omitted. Use a usable checkbox fallback; not the ARIA switch role.
HTML Reference