Measured entry
shadcn-switch
A client-side React switch that wraps the Radix Switch primitive and ships as source code for your app. Its styling is expressed through Tailwind utility classes and theme tokens, while class merging comes from the local cn helper backed by clsx and tailwind-merge.



Measured
Every value below was written by the harness on the run that produced the frames above. None of it is derived from the prose.
| Build | OK |
|---|---|
| Mount | OK |
| Console errors | 0 |
| Uncaught page errors | 0 |
| Horizontal overflow | clean at 375, 768, 1440 |
| Axe critical | 0 |
| Axe serious | 0 |
| Axe moderate | 0 |
| Axe minor | 0 |
| Gzip marginal | 34.4 KB (99.9 KB build, 65.5 KB baseline) |
| Bare mode | OK |
| Provider required | NO |
| Demo used | written from the component source API |
Verdict
A dependable, narrowly scoped switch for React teams already aligned with Radix and Tailwind. It built and mounted cleanly in both configured and bare checks, so the main tradeoff is adopting its styling conventions and runtime primitive for a very small control.
Use it if
- You need an accessible on-or-off control that fits an existing shadcn and Tailwind design system.
- You want a controlled or uncontrolled React switch whose source can be adjusted locally.
- You already use Radix primitives and want consistent focus, disabled, size, and dark-theme states.
Skip it if
- Your product needs a checkbox rather than a switch because the choice is submitted with a form instead of taking effect immediately.
- Your app does not use Tailwind or shadcn theme tokens and you do not want to translate its utility classes.
- You want a dependency-free native control and do not need Radix state handling.
Install
| Declared dependencies | radix-ui, clsx, tailwind-merge |
|---|---|
| Missing on install | none |
| Bare install | builds and mounts without the shadcn-style helpers |
| Provider | no provider required in the harness |
In a non-shadcn project, add radix-ui, Tailwind CSS, and a cn helper backed by clsx and tailwind-merge. Define the referenced color, border, focus-ring, shadow, and dark-theme tokens, and replace the @ alias import if your build does not resolve it.
Source and credit
This page is a review, not a copy. The component source lives with its author and this site does not republish it. Read the license before you use anything.
Author repository
github.com/shadcn-ui/uiAlternatives
Other published entries for the switch pattern, ordered by what they measured: mounts first, then clean axe scans, then bare-mode passes, then the smaller bundle.
- neu-toggleneumorphism
- Renders
- YES
- A11y
- 0
- Gzip
- 17.8KB
- Bare
- pass
- Prov
- NO
- clay-toggleclaymorphism
- Renders
- YES
- A11y
- 0
- Gzip
- 18.2KB
- Bare
- pass
- Prov
- NO
- ruixen-scrub-datetimeunclassified
- Renders
- YES
- A11y
- 0
- Gzip
- 22.2KB
- Bare
- pass
- Prov
- NO
- hextaui-switchminimal-flat
- Renders
- YES
- A11y
- 0
- Gzip
- 34.5KB
- Bare
- pass
- Prov
- NO
- hextaui-tabsminimal-flat
- Renders
- YES
- A11y
- 0
- Gzip
- 39.0KB
- Bare
- pass
- Prov
- NO
- ruixen-animated-theme-togglerunclassified
- Renders
- YES
- A11y
- 0
- Gzip
- 61.8KB
- Bare
- pass
- Prov
- NO