Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

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

PropTypeDefaultWhat it does
on—Each icon (MenuIcon, PlayIcon, HeartIcon, BellIcon, ThemeIcon, BookmarkIcon, VolumeIcon, LockIcon) takes its state as on.
burst—HeartIcon only: increase it to play a new burst.
autoplayfalseAnimatedIcons grid only: toggles the icons in turn until someone interacts.
speed1How fast the animation plays, 0.25 to 4. Higher is quicker. Every icon takes it, and so does the grid.
size26Each icon only: width and height in px.
iconSize26AnimatedIcons grid only: size of each icon in px, 14 to 48.
tileSize72AnimatedIcons grid only: width and height of each button tile in px, 48 to 96.
tileRadius20AnimatedIcons grid only: corner radius of the tiles in px. Half the tile size makes a circle.

Add it to your project

  1. 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 creates components.json and the cn() helper in src/lib/utils.ts:

    npx shadcn@latest init -d

    Starting from nothing? The Quick Start walks through the whole thing.

  2. 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:

    1. Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with nxs_ and is shown only once.
    2. In your project root, next to package.json, create a file named .env.local with this line, using your own key:
      NEXUS_API_KEY=nxs_your_key_here
    3. Open components.json and 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}"
          }
        }
      }

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.