# Install and animate React icons

Install with shadcn CLI or copy TSX manually. Control hover motion or call startAnimation() / stopAnimation() from a ref.

## Install

```bash
npx shadcn@latest add https://www.itshover.com/r/github-icon.json
```

Several icons:

```bash
npx shadcn@latest add \
  https://www.itshover.com/r/github-icon.json \
  https://www.itshover.com/r/heart-icon.json \
  https://www.itshover.com/r/plug-connected-icon.json
```

Manual: `npm install motion`, copy `icons/types.ts`, copy icon TSX.

## Usage

In the App Router, the file that imports an icon component should be a Client Component. Server Components cannot use Motion hooks or refs.

In Vite or Create React App, import icons normally in any component—no "use client" directive is required.

## API

Props: size, color, strokeWidth, className (see icons/types.ts).

Ref: startAnimation(), stopAnimation().

```tsx
"use client";

import { useRef } from "react";
import type { AnimatedIconHandle } from "@/icons/types";
import HeartIcon from "@/icons/heart-icon";

export function HeartButton() {
  const iconRef = useRef<AnimatedIconHandle>(null);
  return (
    <button
      type="button"
      onMouseEnter={() => iconRef.current?.startAnimation()}
      onMouseLeave={() => iconRef.current?.stopAnimation()}
    >
      <HeartIcon ref={iconRef} size={32} />
    </button>
  );
}
```

## Accessibility

Most icons render as inline SVG without aria-hidden by default. Decorative uses should set aria-hidden on the icon or provide an accessible name on a parent control. Motion does not automatically respect prefers-reduced-motion in every icon; wrap animations or conditionally call stopAnimation() when matchMedia('(prefers-reduced-motion: reduce)') matches.

## FAQ

## Is Its Hover free and what license applies?

Yes. Icon source on its Hover is licensed under Apache-2.0. See the LICENSE file in the GitHub repository for the full text.

## Does it work with Next.js?

Yes. Icons are React components built with Motion. In the Next.js App Router, import them from a Client Component file (add "use client" at the top of your file) because Motion runs on the client.

## Do I need Framer Motion or Motion?

Install the motion package (npm install motion). Its Hover icons import from "motion/react", not the legacy framer-motion package name.

## How do I trigger animation without hover?

Attach a ref typed as AnimatedIconHandle and call startAnimation() or stopAnimation() from event handlers—for example onClick on a parent button.

## How do I change size or color?

Pass size (number or CSS string), color (defaults to currentColor), strokeWidth, or className—the same props defined in icons/types.ts on every icon.

## How many icons are in the library?

Its Hover ships 263 animated React icons. Browse them at https://www.itshover.com/icons or by category at https://www.itshover.com/icons/categories.

Canonical: https://www.itshover.com/docs
