Using the Animations Library
A complete reference for every CSS utility class and Framer Motion variant available in TaylorUI. Use this page to pick the right animation for your use case.
See interactive demos →
What you can find on this page:
CSS Utilities
The CSS animation system has two layers:
Convenience presets — single-class animations with duration and easing defaulting to the design tokens. Reach for these by default. Override timing with duration-_ and ease-_ when the defaults aren't right.
animate-in-* presets default to slow (500ms) + ease-out. animate-out-* presets default tofast (150ms) + ease-in.
Base layer — composable primitives for full control. Use when no preset covers your combination — e.g. a directional slide with custom timing, or mixing enter properties the presets don't expose.
Enter presets
{/* default timing from tokens */}
<div className="data-[state=visible]:animate-in-fade-up" data-state="hidden">
Animated element
</div>;
{/* tuned timing */}
<div
className="data-[state=visible]:animate-in-fade-up duration-200"
data-state="hidden"
>
Animated element
</div>;Combine these with data-state attributes to trigger animations:
| Utility class | Effect |
|---|---|
animate-in-fade | Fade from opacity: 0 to opacity: 1 |
animate-in-fade-up | Fade in while sliding up (1.5rem) |
animate-in-fade-down | Fade in while sliding down |
animate-in-fade-left | Fade in while sliding from the right |
animate-in-fade-right | Fade in while sliding from the left |
animate-in-zoom | Fade in while scaling from 0.85 |
animate-in-spin | Fade in while spinning from -30° |
Exit presets
{/* default timing from tokens */}
<div className="data-[state=visible]:animate-out-fade" data-state="hidden">
Animated element
</div>;
{/* tuned timing */}
<div
className="data-[state=visible]:animate-in-fade-down duration-200"
data-state="hidden"
>
Animated element
</div>;Pair with enter presets for open/close UI like dropdowns and popovers:
| Utility class | Effect |
|---|---|
animate-out-fade | Fade from opacity: 1 to opacity: 0 |
animate-out-fade-up | Fade out while sliding up |
animate-out-fade-down | Fade out while sliding down |
animate-out-fade-left | Fade out while sliding left |
animate-out-fade-right | Fade out while sliding right |
animate-out-zoom | Fade out while scaling to 0.85 |
animate-out-spin | Fade out while spinning to 30° |
Base layer
<div className="animate-in fade-in slide-in-from-top-1 duration-200 ease-out">
Entering element
</div>
<div className="animate-out fade-out slide-out-to-top-1 duration-150 ease-in">
Exiting element
</div>For custom animations, compose animate-in or animate-out with direction
modifiers:
| Layer | Utility | Purpose |
|---|---|---|
| Trigger | animate-in | Play the enter keyframe |
| Trigger | animate-out | Play the exit keyframe |
| Opacity | fade-in / fade-out | Opacity from/to 0 |
| Rotation | spin-in / spin-out | Rotate from −30° / to +30° |
| Slide Y | slide-in-from-top-* | Slide in from above (spacing scale) |
| Slide Y | slide-in-from-bottom-* | Slide in from below |
| Slide X | slide-in-from-left-* | Slide in from the left |
| Slide X | slide-in-from-right-* | Slide in from the right |
| Slide Y (exit) | slide-out-to-top-* | Slide out upward |
| Slide Y (exit) | slide-out-to-bottom-* | Slide out downward |
| Slide X (exit) | slide-out-to-left-* | Slide out left |
| Slide X (exit) | slide-out-to-right-* | Slide out right |
Duration & easing overrides
Append these utilities to override the default timing. The standalone presets
use --animation-duration-slow (500ms) and --animation-ease-out by default.
| Utility | Token value |
|---|---|
duration-150 | --animation-duration-fast (150ms) |
duration-300 | --animation-duration-base (300ms) |
duration-500 | --animation-duration-slow (500ms) |
duration-800 | --animation-duration-slower (800ms) |
ease-default | cubic-bezier(0.4, 0, 0.2, 1) |
ease-in | cubic-bezier(0.4, 0, 1, 1) |
ease-out | cubic-bezier(0, 0, 0.2, 1) |
ease-spring | cubic-bezier(0.34, 1.56, 0.64, 1) |
data-state
Toggle data-state yourself to trigger presets on hover, click, or other
interactions:
<div
className="data-[state=hidden]:opacity-0 data-[state=visible]:animate-in-fade-up"
data-state={isVisible ? 'visible' : 'hidden'}
>
Controlled element
</div>Framer Motion
Use Framer for gesture-driven interactions, coordinated stagger timelines, or route-level transitions that are easier to express in JS.
import { motion } from 'framer-motion';
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} />;Import variants and presets from @/animations. Each variant defines hidden
and visible states so they work with initial / animate props on
motion components. Presets are spread directly onto motion elements.
Variants
| Import | hidden state | visible state | Use for |
|---|---|---|---|
fadeUp | opacity: 0, y: 24 | opacity: 1, y: 0 | Scroll reveals, card entrances |
fadeDown | opacity: 0, y: -24 | opacity: 1, y: 0 | Dropdowns, top-to-bottom UI |
fadeIn | opacity: 0 | opacity: 1 | Subtle content reveals |
slideInFromLeft | opacity: 0, x: -24 | opacity: 1, x: 0 | Side panels, drawers |
slideInFromRight | opacity: 0, x: 24 | opacity: 1, x: 0 | Side panels, drawers |
zoomIn | opacity: 0, scale: 0.95 | opacity: 1, scale: 1 | Modals, focused overlays |
spin | opacity: 0, rotate: -180, scale: 0.95 | opacity: 1, rotate: 0, scale: 1 | Playful icon reveals |
staggerContainer | (none) | staggerChildren: 0.1 | Parent for staggered lists |
import { motion } from 'framer-motion';
import { fadeUp, staggerContainer } from '@/animations';
<motion.div variants={staggerContainer} initial="hidden" animate="visible">
<motion.div variants={fadeUp}>Item 1</motion.div>
<motion.div variants={fadeUp}>Item 2</motion.div>
<motion.div variants={fadeUp}>Item 3</motion.div>
</motion.div>;Presets
Presets are pre-configured MotionProps objects with initial, animate,
exit, and transition already set. Spread them directly onto any motion
component.
| Import | Behaviour | Use for |
|---|---|---|
pageTransition | Fades up on enter, fades down on exit (300ms) | Route transitions, sections |
modalTransition | Scales up with spring on enter, scales down on exit (200ms) | Dialogs, modals |
import { AnimatePresence, motion } from 'framer-motion';
import { pageTransition } from '@/animations';
<AnimatePresence mode="wait">
<motion.div key={pathname} {...pageTransition}>
{children}
</motion.div>
</AnimatePresence>;What to copy into another project
src/animations/css/src/animations/framer/src/animations/components/src/animations/index.ts
In your global stylesheet, include:
@import '../animations/css/animations.css'; /* includes tokens.css */