# Install Keyframery in Next.js (/docs/installation/next)

Add Keyframery's animated UI SDK components to a Next.js App Router project with the shadcn CLI: a new project, a Create preset, or an existing app.

Choose the setup that matches your starting point.

- [Use Keyframery Create](#use-keyframery-create): Build your preset, then install it into a new Next.js app.
- [Use the CLI](#use-the-cli): Scaffold a new Next.js project from the terminal.
- [Existing Project](#existing-project): Add Keyframery to a Next.js app you already have.

## Use Keyframery Create [#use-keyframery-create]

### Build your preset [#build-your-preset]

Open [Keyframery Create](/create) and pick your colours, corners, font and motion. Copy the command under the preview.

### Create the project [#create-the-project]

```bash
npx shadcn@latest init -t next
```

### Add the preset [#add-the-preset]

Run the command you copied from the project's folder:

```bash
npx shadcn@latest add @keyframery/preset-<code>
```

It writes the colours, corners and motion into `app/globals.css`. A preset with a font adds it to `app/layout.tsx` with `next/font/google`.

### Add components [#add-components]

```bash
npx shadcn@latest add @keyframery/tabs
```

Then [use it in a page](#use-it).

## Use the CLI [#use-the-cli]

### Create the project [#create-the-project-1]

```bash
npx shadcn@latest init -t next
```

For a project inside a monorepo, add `--monorepo`.

### Add components [#add-components-1]

```bash
npx shadcn@latest add @keyframery/tabs
```

The files land in `components/keyframery/` (`src/components/keyframery/` if your app uses a `src` folder), and the motion tokens go into `app/globals.css`.

### Use it [#use-it]

```tsx title="app/page.tsx"
import { Tabs, TabsList, TabsPanel, TabsPanels, TabsTab } from "@/components/keyframery/tabs"

export default function Page() {
  return (
    <Tabs defaultValue="account">
      <TabsList aria-label="Settings">
        <TabsTab value="account">Account</TabsTab>
        <TabsTab value="password">Password</TabsTab>
      </TabsList>
      <TabsPanels>
        <TabsPanel value="account">Account settings</TabsPanel>
        <TabsPanel value="password">Password settings</TabsPanel>
      </TabsPanels>
    </Tabs>
  )
}
```

The page stays a Server Component. The tabs are client components already, marked `"use client"` in their files.

## Existing Project [#existing-project]

### Check the setup [#check-the-setup]

You need React 19, Tailwind CSS v4 and a `components.json`. A project made with `create-next-app` and Tailwind only needs the shadcn CLI set up:

```bash
npx shadcn@latest init
```

### Add components [#add-components-2]

```bash
npx shadcn@latest add @keyframery/tabs
```

The CLI reads your aliases from `components.json`, so the files go wherever your components live.

## Notes for Next.js [#notes-for-nextjs]

* **Server rendering.** The components render on the server and start animating once the page hydrates.
* **`cacheComponents`.** Calendar, Date Picker and Date Input read today's date while they render. With `cacheComponents` turned on, render them inside `<Suspense>` after `await connection()`. [See the fix](/docs/troubleshooting#nextjs-stops-with-unstable-value-datenow).
* **Motion style.** `<KeyframeryProvider motion="calm">` in `app/layout.tsx` sets it for the whole app, or put `data-motion="calm"` on `<html>` yourself.

## Questions

### Do the components work in Server Components?

Import them from a Server Component page like any client component. Every file that holds state already starts with `"use client"`, so the page itself stays on the server.

### How does a preset's font load in Next.js?

The CLI adds it with `next/font/google` in `app/layout.tsx` and points `--font-sans` at it, so the font is self-hosted and preloaded.
