Toggle

A two-state button that can be either on or off.

Features

  • Full keyboard navigation.
  • Can be controlled or uncontrolled.

Install

Import

API

Root

Props Type Default
as
AsTag | Component
button
asChild
boolean
false
defaultValue
boolean
undefined
disabled
boolean
false
pressed
boolean
undefined
Event Type
update:pressed
[_value: boolean]
Data attribute Value
[data-state]
'on' | 'off'
[data-disabled]
Present when disabled