structyl

Switch

stable

A control that allows the user to toggle between checked and not checked.

Basic usage

Examples

Controlled toggle

Track the checked state externally to drive other UI.

Status: disabled

Settings list

Use controlled or uncontrolled switches inside dense settings panels.

Release preferences
Realistic app composition
Example

Semantic colors

Switch accepts a color prop to match the semantic context of the toggle.

Features

  • Full keyboard navigation.
  • Can be controlled or uncontrolled.
  • iOS-style spring thumb animation.

Installation

bash
pnpm dlx structyl add switch

API Reference

Switch API reference

Full props, types, defaults.

View API

Keyboard interactions

Adheres to the WAI-ARIA design pattern .

KeyDescription
Space / EnterToggles the switch.
Switch | structyl