Animated Icons, animated React component
Eight toggle icons with their own small stories: menu to close, play morphing into pause, a heart that bursts, a bell that rings, sun turning to moon, a bookmark that fills, sound muting and a lock that springs open.
- Pro
- Motion Effects
- Hover
- Spring
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| on | boolean | — | Each icon (MenuIcon, PlayIcon, HeartIcon, BellIcon, ThemeIcon, BookmarkIcon, VolumeIcon, LockIcon) takes its state as on. |
| burst | number | — | HeartIcon only: increase it to play a new burst. |
| autoplay | boolean | false | AnimatedIcons grid only: toggles the icons in turn until someone interacts. |
| speed | number | 1 | How fast the animation plays, 0.25 to 4. Higher is quicker. Every icon takes it, and so does the grid. |
| size | number | 26 | Each icon only: width and height in px. |
| iconSize | number | 26 | AnimatedIcons grid only: size of each icon in px, 14 to 48. |
| tileSize | number | 72 | AnimatedIcons grid only: width and height of each button tile in px, 48 to 96. |
| tileRadius | number | 20 | AnimatedIcons grid only: corner radius of the tiles in px. Half the tile size makes a circle. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry with your API key
Animated Icons is a Pro item, so the CLI has to send your API key. Do this once per project:
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
nxs_and is shown only once. - In your project root, next to
package.json, create a file named.env.localwith this line, using your own key:NEXUS_API_KEY=nxs_your_key_here
- Open
components.jsonand add this entry inside the outermost braces, next to"aliases". Leave{name}and${NEXUS_API_KEY}exactly as written; the CLI fills them in:"registries": { "@nexus-labs": { "url": "https://www.nexus-ui.com/api/registry/{name}", "headers": { "Authorization": "Bearer ${NEXUS_API_KEY}" } } }
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
Animated Icons questions
How do I install Animated Icons?
Run `npx shadcn@latest add @nexus-labs/animated-icons`. It installs framer-motion, and every icon is an inline SVG with no icon font or image files. It is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).
How do I use a single icon instead of the grid?
Import `MenuIcon`, `PlayIcon`, `HeartIcon`, `BellIcon`, `ThemeIcon`, `BookmarkIcon`, `VolumeIcon` or `LockIcon` and pass `on` to set its state. `size` is in px (default 26), and `HeartIcon` also needs `burst`, a number you increase each time you want a new burst.
How do I change the animation speed and tile size?
`speed` runs from 0.25 to 4 with a default of 1, and it works on every icon and on the `AnimatedIcons` grid. The grid also takes `iconSize` (default 26, 14 to 48), `tileSize` (default 72, 48 to 96) and `tileRadius` (default 20).
Are the icons accessible?
In the grid, each tile is a button with `aria-pressed` and a text label, and the SVGs are marked `aria-hidden`. If you use an icon on its own, put it inside your own button and give that button the accessible name. The component does not check prefers-reduced-motion.