Skip to content
h v3.13.3
Search the docs
Find a component, section or page.

Toggle

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

Installation

pnpm add @heyramzi/ui bits-ui

Usage

import { Toggle } from "@heyramzi/ui/shadcn/toggle";

Keyboard and accessibility

Key Does
Space Enter Turns the toggle on or off.
  • It's a button that reports pressed or not pressed.
  • An icon-only toggle needs an aria-label that names the thing it turns on, like "Bold".

API reference

variant "default" | "outline"
Default "default"
size "default" | "sm" | "lg"
Default "default"
ref bindable HTMLElement | null
Default null
pressed bindable boolean
Default false
class string
...rest
Every prop of Toggle.Root from bits-ui
Prop Type Default
variant "default" | "outline" "default"
size "default" | "sm" | "lg" "default"
ref bindable HTMLElement | null null
pressed bindable boolean false
class string
...rest Every prop of Toggle.Root from bits-ui