Skip to Content
Columbus

Toggle

A button that switches between two states.

Installation

pnpm dlx shadcn@latest add @columbus/toggle

Usage

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

<Toggle aria-label="Bold">
  <BoldIcon />
</Toggle>;

Toggle renders a <button> with aria-pressed. Give icon-only toggles an aria-label.

Icon toggles

For a set of related toggles with shared state, use Toggle Group.

Sizes

API reference

Also accepts every Base UI Toggle prop, like pressed, defaultPressed, onPressedChange, and disabled.

Prop

Type

toggleVariants is also exported, to style other elements like a toggle.

On this page