Search documentation

Search the documentation and open a page.

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

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/toggle

Composition

Toggle └── ToggleIndicator (optional)

Examples

Default

Loading...

Disabled

Loading...

Sizes

Loading...

Variants

Loading...

With Icon

Loading...

With Tooltip

Loading...

API Reference

Toggle

PropTypeDefaultDescription
idstring | undefined—Unique identifier used to connect the component parts.
disabledboolean | undefinedfalseDisables interaction with the component.
defaultPressedboolean | undefined—Configures default pressed.
pressedboolean | undefined—Configures pressed.
onPressedChange((pressed: boolean) => void) | undefined—Runs when pressed changes.
size"default" | "lg" | "sm""default"-
variant"default" | "outline""default"-

Context, Hooks, and Types

ExportAPI
ToggleContextRender-prop component that exposes component state and actions.
useToggleCreates or accesses the component API.
useToggleContextReturns the nearest component API.

Utilities and Supporting Types

ExportAPI
toggleVariantsStyle recipe used to reuse the component variants.