# HeroUI Toggle Button

> HeroUI v3 ToggleButton — a two-state button that stays pressed/selected when toggled, for like, bookmark, mute and similar on/off actions. Supports default and ghost variants, sm/md/lg sizes, icon-only mode, controlled selection via isSelected/onChange, render-prop children for per-state content, and disabled state, with full React Aria toggle semantics and accessibility. A thin re-export of the genuine @heroui/react package with @heroui/styles, so consumers install and render the real HeroUI primitive.

- Author: [Hero Ui](https://21st.dev/@hero_ui)
- Library: [Hero Ui](https://21st.dev/@hero_ui/library/hero-ui)
- License: mit
- Tags: Button, Toggle, Selection, Toggle Button
- npm dependencies: @heroui/react, @heroui/styles
- Live preview: https://21st.dev/@hero_ui/components/heroui-toggle-button

## Install

```bash
npx shadcn@latest add "https://21st.dev/r/hero_ui/heroui-toggle-button?api_key=$API_KEY_21ST"
```

Requires a 21st API key (generate one at https://21st.dev/mcp) passed as `API_KEY_21ST`. Free accounts get a limited number of installs per day; unlimited on a paid plan — see https://21st.dev/pricing.

Full component directory: https://21st.dev/llms.txt · More like this: https://21st.dev/community/components/s/button.md
