Toggle

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

Anatomy

Import the component and use it as a single part:

Anatomy

API reference

PropTypeDefault
value

string

undefined

defaultPressed

boolean

false

pressed

boolean

undefined

onPressedChange

((pressed: boolean, event: Event) => void)

undefined

disabled

boolean

false

className

| string
| ((state: Toggle.State) => string)

undefined

render

| ReactElement
| ((props: HTMLProps, state: Toggle.State) => ReactElement)

undefined

Attribute
Description
data-pressed