Skip to content
Dumb UI

Search Dumb UI

Jump to a page or component, or switch the style

Search Dumb UI

Jump to a page or component, or switch the style

Toggle

A two-state button. Pressed state is physical in every style: it latches down.

Props
$ pnpm dlx shadcn@latest add @dumb/toggle

Needs the @dumb registry in components.json and the style tokens. See Installation.

import { Toggle } from "@/components/ui/toggle"
<Toggle aria-label="Toggle bold">
  <TextBIcon />
</Toggle>

Outline

Outline toggles read as keys on a toolbar.

API reference

Matches shadcn/ui. Native props are forwarded.

Toggle

PropTypeDefault
variant"default" | "outline"

Ghost or outlined key.

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

Height from --du-h-* tokens.

"default"
pressedboolean

Controlled pressed state.

-
onPressedChange(pressed: boolean) => void

Called when the pressed state changes.

-
Space
Toggles the pressed state.
Enter
Toggles the pressed state.