UIIcons

Switch

A toggle control for switching between two states, like on and off.

Switch

Installation

pnpm dlx stera-ui@latest add switch

Examples

With Description

Place FieldContent between the label and switch to add a description.

Receive emails about new products, features, and more.

With Description

Choice Card

Wrap a Field inside FieldLabel to make the entire card clickable. The card highlights automatically when the switch is checked.

Choice Card

Sizes

Sizes
SizeDescription
smCompact size (24×16)
mdStandard size (32×16)
lgLarge size (64×28)

Disabled

Disabled

API Reference

Built on Base UI's Switch primitive — see the full API reference there.

PropTypeDefault
size"sm" | "md" | "lg""md"
checkedboolean
defaultCheckedboolean
onCheckedChange(checked: boolean) => void
disabledbooleanfalse
namestring
valuestring