Toggle
Icon Toggle
NewA like, bookmark, star or bell button that fills, pops and bursts when it turns on, with a count that rolls.
npx motionsnack add icon-toggleCustomize
<IconToggle />Props
11 properties
| Property | Type | Default | Description |
|---|---|---|---|
| pressed | boolean | - | Controlled state. Leave undefined to let the component manage it. |
| defaultPressed | boolean | false | State on first render when uncontrolled. |
| onChange | (pressed: boolean) => void | - | Called with the new state on every change. |
| className | string | '' | Extra classes on the button. |
| icon | 'heart' | 'bookmark' | 'star' | 'bell' | 'heart' | Which icon the toggle shows. |
| variant | 'outline' | 'ghost' | 'outline' | Icon only, or a pill with a border and the count. |
| size | 'sm' | 'md' | 'sm' | Size: button 36 / 44 px, icon 16 / 20 px. |
| label | string | 'Like' | Name for screen readers. |
| count | number | 128 | Count without this visitor's own press; it adds one while pressed. Below 0 hides it. |
| burst | boolean | true | Burst of small lines around the icon when it turns on. |
| disabled | boolean | false | Disables the toggle. |
About Icon Toggle
Icon Toggle is the small button that makes saving or liking feel good. Turning it on fills the icon, squeezes and pops it past its size and sends a ring of tiny lines flying out around it; turning it off simply empties the icon again, without the fuss. Next to it a count rolls up by one as the new number slides in and the old one slides away, and back down when the press is undone. The icon can be a heart, a bookmark, a star or a bell, shown bare or in a pill with a border, in three sizes. It stays black and white by default, and one colour prop gives the pressed icon and its burst their own colour, like a red heart. It is a real toggle button with a pressed state for screen readers and the library's focus outline, and the burst is skipped for visitors who prefer reduced motion.
What's included
- Fill, pop and a burst of lines when it turns on
- Count that rolls up and down
- Heart, bookmark, star or bell
- Icon only or a pill with a border
- Optional active colour, black and white by default
- Pressed state for screen readers, focus outline
- Light and dark look
- Type
- Animated React toggle component
- Library
- Components · Toggle
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-11-23