# Toggle Button

> Pressable toggle that stays on until pressed again.

Registry name: `toggle-button`. HTML docs: https://ui.anuragroy.dev/component/toggle-button.

## Install

```bash
npx shadcn@latest add https://ui.anuragroy.dev/r/toggle-button.json
```

If the website is down: `npx shadcn@latest add https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/toggle-button.json`.

Registry JSON: https://ui.anuragroy.dev/r/toggle-button.json (GitHub: https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/toggle-button.json).

## Import

Import paths follow the consumer `components.json` aliases. After a default install:

```tsx
import { ToggleButton } from "@/components/ui/toggle-button"
```

## Usage

```tsx
import { ToggleButton } from "@/components/ui/toggle-button"

export function Example() {
  return <ToggleButton>Toggle me</ToggleButton>
}
```

## API

### ToggleButton

Wraps Base UI Toggle. Accepts the primitive’s props (`pressed`, `defaultPressed`, `onPressedChange`).

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | "solid" \| "outline" \| "ghost" | "solid" |  |
| `size` | "sm" \| "md" \| "lg" \| "icon" \| "icon-sm" \| "icon-lg" | "md" |  |

## See also

- [HTML page](https://ui.anuragroy.dev/component/toggle-button): Preview and the same docs in the site chrome.
- [Registry item](https://ui.anuragroy.dev/r/toggle-button.json): Source files and dependencies.
- [Catalog](https://ui.anuragroy.dev/component): All components.
- [llms.txt](https://ui.anuragroy.dev/llms.txt): Agent index for this library.
