ComponentClient component

Toggle

A two-state button with tactile default and outline treatments.

Installation

Preview

Usage

tsx
import { Bold } from "lucide-react"
import { Toggle } from "@/components/ui/toggle"

<Toggle aria-label="Toggle bold" variant="outline">
  <Bold />
</Toggle>

API reference

PropTypeDefaultDescription
variant"default" | "outline""default"Controls the surrounding surface.
size"sm" | "default" | "lg""default"Controls the hit area and padding.
pressedbooleanControls the active state.
classNamestringOverrides or extends the generated Tailwind classes.
disabledbooleanfalsePrevents user interaction when supported.