<ToggleButton aria-label="Toggle pin">
<PinIcon className="rotate-45" />
</ToggleButton>npx shadcn@latest add @dotui/toggle-buttonUse toggle buttons to allow users to toggle a selection on or off, like pinning or starring an item.
import { ToggleButton } from "@/components/ui/toggle-button";<ToggleButton aria-label="Toggle pin">
<PinIcon />
</ToggleButton>Use the controls below to experiment with different toggle button props and see the live preview and code update.
The visual style of the toggle button.
"default" | "quiet"The size of the toggle button.
"sm" | "md" | "lg"<ToggleButton aria-label="Toggle pin" variant="default" size="md">
<Pin className="rotate-45" />
</ToggleButton>A toggle button allows a user to toggle a selection on or off, for example switching between two states or modes.
| Prop | Type | Default | |
|---|---|---|---|
"default" | "quiet" | 'default' | ||
"sm" | "md" | "lg" | 'md' | ||
"default" | "square" | "auto" | "auto" | ||
Key | — | ||
boolean | — | ||
boolean | — | ||
boolean | — | ||
ReactNode | function | — | ||
function | — | ||
Last updated on 1/13/2026
Bringing singularity to the web.
Built with passion by @mehdibha.