Ballmac UI home

Toggle

A compact two-state action with distinct pressed styling, visible keyboard focus, and outline or filled variants.

Atlas launch

Pinned to your sidebar

Installation

$ pnpm dlx shadcn@latest add @ballmac/toggle

Usage

import { Toggle } from "@/components/ballmac/toggle"

The full example is in the Code tab above.

Examples

Sizes and states

Small, outline, disabled

API reference

PropTypeDefault
variant

Surface treatment of the two-state control.

"default" | "outline""default"
size

Control height and horizontal padding.

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

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
TabFocuses the toggle
Enter / SpaceChanges pressed state

Use with AI

An on/off action such as pinning or formatting that communicates its pressed state to assistive technology. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Toggle (@ballmac/toggle) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • A toolbar action with persistent pressed state
  • Favorite or pin control

Not for

  • Boolean form field; use switch
  • Multiple related choices; use toggle-group

Registry JSON: https://ui.ballmac.com/r/toggle.json

Credits

Free to use in personal and commercial projects.

Registry
shadcn/utils