Search components

Find a component by name

Switch

On/off toggle switch.

Description

Use a horizontal Field with FieldContent and FieldDescription to add helper text next to the switch.

Focus is shared across devices, and turns off when you leave the app.

Choice Card

A card-style setting with the same look as RadioGroupItemBoxed and CheckboxBoxed: a Label wraps the text and the Switch, so the whole card toggles it, and it turns primary-subtle with a primary-border when on. There is no boxed switch component; copy the classes from the code.

Disabled

Add the disabled prop to the Switch to disable it, and data-disabled to the Field to dim its label.

Invalid

Add data-invalid to the Field to turn its label destructive, and aria-invalid to the Switch for assistive tech. Refer's Switch has no invalid styling of its own yet.

You must accept the terms and conditions to continue.

Size

Use the size prop ("default" or "sm") to change the size of the switch.

Installation

npx shadcn@latest add @refer/switch

Variations

Ported from shadcn's examples. Open Code on any section to see and copy it.

Basic
With Description
With Label
Disabled
Sizes

Usage in the apps

Which apps install this component, whether their copy matches the registry, and which files import it.

PortalIn sync6 files
ArgusDiverged3 files
LandingDivergedNot imported
PartnersDiverged1 file

Imported by 10 files across the apps. From olympus-backend@2ee40d05e, Oct 26, 2026. โ€œIn syncโ€ means the app's copy matches this registry; refresh with npm run usage:build.