Keyframery

Install Keyframery in Astro

Add Keyframery's animated UI SDK components to an Astro site as React islands: install them with the shadcn CLI and hydrate each one with a client directive.

Choose the setup that matches your starting point.

Use Keyframery Create

Build your preset

Open Keyframery Create and pick your colours, corners, font and motion. Copy the command under the preview.

Create the project

npx shadcn@latest init -t astro

Add the preset

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

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

It writes the colours, corners and motion into src/styles/global.css. A preset with a font installs it from Fontsource and imports it there too.

Add components

npx shadcn@latest add @keyframery/tabs

Then use it in a page.

Use the CLI

Create the project

npx shadcn@latest init -t astro

The template adds Astro's React integration and Tailwind CSS v4. For a project inside a monorepo, add --monorepo.

Add components

npx shadcn@latest add @keyframery/tabs

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

Use it

Put the parts together in a React component:

src/components/settings-tabs.tsx
import { Tabs, TabsList, TabsPanel, TabsPanels, TabsTab } from "@/components/keyframery/tabs"

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

Then use it in a page with a client directive, so it hydrates:

src/pages/index.astro
---
import Layout from "@/layouts/main.astro"
import SettingsTabs from "@/components/settings-tabs"
---

<Layout>
  <SettingsTabs client:load />
</Layout>

Existing Project

Check the setup

You need Astro's React integration (npx astro add react), Tailwind CSS v4 and the @/* alias in tsconfig.json. shadcn's Astro guide has each step. Then set up the CLI:

npx shadcn@latest init

Add components

npx shadcn@latest add @keyframery/tabs

Notes for Astro

  • Client directives. Without one, a React component is static HTML: it shows, but nothing opens, slides or responds. Use client:load for what's on screen at once, client:visible for what's further down.
  • One island per widget. A dialog and the button that opens it, or tabs and their panels, belong in the same .tsx file and the same island.
  • Motion style and speed. Put data-motion="calm" on <html> in your layout, so the style is there before any island hydrates. A speed set on KeyframeryProvider only reaches the components in its own island.

Questions

Why don't my components animate in Astro?

Astro renders React components to static HTML unless you add a client directive. Add client:load (or client:visible) where you use them, so they hydrate and respond.

Can I write `<Tabs>` and `<TabsTab>` straight into an .astro file?

Not as one interactive component. Each island hydrates on its own and children passed from Astro arrive as static HTML, so the parts can't share state. Put them together in a .tsx file and use that one component in your page.

On this page