R 8R 12
4
896 × 54
ComposeUI
ComponentsChartsBlocksDocs

Let's have coffee?

R 16
Subham avatar
Want to work together? Just want to chat?
Subham avatar
Check out my portfolio: subham12r.dev
Subham avatar
Or grab 15 mins on my calendar:
Coffee chat
Portfoliosubham12r.dev
Mail
hello@subham12r.dev
Socials
X / Twitter·GitHub·LinkedIn
Explore
Components·Charts·Blocks·Docs

Designed and built by Subham

ComposeUIComposeUI
© 2026 ComposeUI·React + Tailwind v4
on

Switch

Fill
Stroke
Color

Switch

Controls

Accessible binary toggle with recessed well track and sculpted beveled thumb.

"use client"; import { useState } from "react";import { Switch } from "@/components/compose/switch"; export function ToggleDemo() {  const [enabled, setEnabled] = useState(true);  return <Switch checked={enabled} onCheckedChange={setEnabled} />;}

Install

Add it with the ComposeUI CLI, or copy the source manually.

$ bunx --bun compose-ui-cli add switch

API Reference

Prop
Type
Default
checked
boolean

Controlled checked state of the switch track.

false
onCheckedChange
(checked: boolean) => void

Callback fired when the user clicks or toggles via keyboard.

—
aria-label
string

Accessible name announced to assistive technologies.

—

Related components

#
R 12
Segmented
R 12
opacity64%
Slider
R 12
clicks: 0
Button

Updated December 2026

R 12
Previous

Button

R 12
Next

Segmented