Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Shadcn Toggle for React and Tailwind

Two-state button that can be toggled on or off.

Installation

bunx --bun shadcn@latest add https://kit.dev/r/toggle.json

Usage

import { Toggle } from "@/components/ui/toggle";
const ToggleDemo = () => <Toggle>Toggle</Toggle>;

Accessibility

KeyDescription
Enter
Activate the focused control.
Space
Activate the focused control.

Demos

Controlled

Disabled

Icon Group

Outline

Size Lg

Size Md

Size Sm

With Icon

API Reference

Toggle

button

PropType
AttributeType

ToggleIndicator

PropType
AttributeType

useToggle

PropType