Toggle
A two-state button. Icons pop slightly when pressed on.
InputsRadix Toggle
Playground
Tweak the props, the preview and the code follow.
Props
<Toggle variant="outline"> <Star /> Star </Toggle>
Installation
npx @plumsydev/plum-ui add toggleUsage
import { Toggle } from "@/components/ui/toggle"<Toggle aria-label="Bold"><Bold /></Toggle>Examples
Outline
Like & save
Controlled toggles with custom pressed colors.
API Reference
Toggle
Extends Radix Toggle.Root.
| Prop | Type | Default |
|---|---|---|
variantVisual style. | "default" | "outline" | "default" |
sizeSize. | "sm" | "default" | "lg" | "default" |
pressed / defaultPressedControlled or initial state. | boolean | — |
onPressedChangeCalled when toggled. | (pressed: boolean) => void | — |
Notes
- Use
toggleVariants()to style other elements like a toggle.