Toggle

Forms

A two-state button that can be either on or off.

Import

import { Toggle } from "@/components/ui/toggle";

Usage

Default

The default toggle style.

Outline

A toggle with an outline.

With Text

A toggle with text and icon.

Sizes

Different toggle sizes.

Disabled

A disabled toggle.

API Reference

variant"default"
"default" | "outline"

The visual style of the toggle

size"default"
"default" | "sm" | "lg"

The size of the toggle

pressed
boolean

Controlled pressed state

onPressedChange
(pressed: boolean) => void

Event handler for pressed state change

disabledfalse
boolean

Whether the toggle is disabled