# Vivace — attribute-driven CSS animations > Vivace is a zero-dependency CSS animation library (under 7 kB gzipped, > CSS + JS) controlled entirely through `data-viv` attributes. A tiny > TypeScript engine handles WHEN animations fire (scroll, hover, click, > focus, mount); generated CSS handles HOW. It works in plain HTML and in > every framework (React, Svelte, Vue, …) because it only reads attributes > — there are no wrapper components. This file is the complete documentation as one markdown document, intended for AI agents and LLMs. Human-readable docs: https://usevivace.dev/docs Package: `vivace` on npm. License: MIT. ## Instructions for AI agents When asked to add animations to a project using Vivace: 1. Install `vivace` (bun/npm/pnpm/yarn), then initialize ONCE at the app root — never per component: ```ts import Vivace from 'vivace-css' import 'vivace-css/vivace.css' Vivace.init() ``` In SSR frameworks run `init()` client-side only (SvelteKit: `$effect` in the root layout; React/Next: `useEffect` in a client component; Vue: `onMounted`). The module itself is SSR-safe to import. Return `Vivace.destroy()` from the lifecycle cleanup. 2. Animate by writing attributes — do NOT write @keyframes, wrapper components, or JS animation code: ```html
``` 3. Elements mounted later (SPA route changes, v-if, conditional rendering) register automatically via MutationObserver — no extra calls. 4. Composition notation rules (IMPORTANT): - Keys start with `@` (animations); modifiers start with `_` (tuning). - Modifiers concatenate directly onto the key they tune, no separator: `@sl-y_ease-out-back_delay-2`. - Separate keys are space-separated: `@fd @sl-y_ease-out-back`. - Never write `@fd@fd` (missing space) or use `|` separators. - Variant grammar: `-x/-y/-z` axis, `-i` enter, `-o` exit, trailing `!` inverts direction: `@sl-y!` slides from below. - CSS matching is substring-based; the notation above is canonical. 5. For lists/grids, put ONE `data-viv` with a `_child-*` modifier on the PARENT; its direct children animate staggered: `