# Install Keyframery in Vite (/docs/installation/vite)

Add Keyframery's animated UI SDK components to a Vite and React project with the shadcn CLI: a new project, a preset from Keyframery Create, 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 Vite app.
- [Use the CLI](#use-the-cli): Scaffold a new Vite project from the terminal.
- [Existing Project](#existing-project): Add Keyframery to a Vite 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 vite
```

### 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 `src/index.css`. A preset with a font installs it from Fontsource and imports it there too.

### Add components [#add-components]

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

Then [use it in your app](#use-it).

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

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

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

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

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

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

The files land in `src/components/keyframery/`, and the motion tokens go into `src/index.css`.

### Use it [#use-it]

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

export default function App() {
  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>
  )
}
```

## Existing Project [#existing-project]

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

You need React 19, Tailwind CSS v4 through `@tailwindcss/vite`, and the `@/` alias in `tsconfig.json`, `tsconfig.app.json` and `vite.config.ts`. [shadcn's Vite guide](https://ui.shadcn.com/docs/installation/vite#existing-project) walks through each file. Then set up the CLI:

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

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

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

## Notes for Vite [#notes-for-vite]

* **Strict builds.** Every Keyframery file passes the template's `noUnusedLocals`, `noUnusedParameters`, `verbatimModuleSyntax` and `erasableSyntaxOnly` checks, so `tsc -b && vite build` stays green.
* **`"use client"`.** The files start with it for frameworks that render on the server. Vite ignores it.
* **Motion style.** Wrap the app in `<KeyframeryProvider motion="calm">` in `src/main.tsx`, or put `data-motion="calm"` on `<html>` in `index.html`.

## Questions

### Does Vite's default build pass with Keyframery installed?

Yes. The shadcn Vite template builds with `tsc -b && vite build` and strict unused-variable checks, and every Keyframery file passes them.

### How does a preset's font load in Vite?

The CLI installs the font's `@fontsource-variable` package and imports it at the top of `src/index.css`, then points `--font-sans` at it.
