Railbase
GPTClaude

Toggle

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

Updated

Default & outline
<Toggle aria-label="Bold">B</Toggle>
<Toggle variant="outline" aria-label="Italic">I</Toggle>

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

Installation

railbase ui add toggle

Peer dependencies:

npm install class-variance-authority

Note

railbase ui add also copies shared primitives — they ship alongside this component automatically.

Usage

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

<Toggle aria-label="Bold">B</Toggle>

Anatomy

Exported parts: toggleVariants · Toggle