Headless Kit v0.2.2

Toggle

A toggle component is a primitive that us used to quickly switch between two possible states.

Building blocks

Examples

WIP

Accessibility

Keyboard interaction

Key

Description

Space
Toggle between states
Tab
Moves focus to the next focusable element.
Shift + Tab
Moves focus to the previous focusable element.

API

Toggle

PropTypeDescription
pressed
boolean

Toggle between pressed and not pressed state

defaultPressed
boolean

The default pressed state when the toggle is rendered

onClick$
function

A custom click handler to wire to the toggle click event

disabled
boolean

Sets whether the toggle is disabled or not