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:

  1. CSS Utilities
  2. Framer Motion
  3. What to copy into another project

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 classEffect
animate-in-fadeFade from opacity: 0 to opacity: 1
animate-in-fade-upFade in while sliding up (1.5rem)
animate-in-fade-downFade in while sliding down
animate-in-fade-leftFade in while sliding from the right
animate-in-fade-rightFade in while sliding from the left
animate-in-zoomFade in while scaling from 0.85
animate-in-spinFade 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 classEffect
animate-out-fadeFade from opacity: 1 to opacity: 0
animate-out-fade-upFade out while sliding up
animate-out-fade-downFade out while sliding down
animate-out-fade-leftFade out while sliding left
animate-out-fade-rightFade out while sliding right
animate-out-zoomFade out while scaling to 0.85
animate-out-spinFade 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:

LayerUtilityPurpose
Triggeranimate-inPlay the enter keyframe
Triggeranimate-outPlay the exit keyframe
Opacityfade-in / fade-outOpacity from/to 0
Rotationspin-in / spin-outRotate from −30° / to +30°
Slide Yslide-in-from-top-*Slide in from above (spacing scale)
Slide Yslide-in-from-bottom-*Slide in from below
Slide Xslide-in-from-left-*Slide in from the left
Slide Xslide-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.

UtilityToken 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-defaultcubic-bezier(0.4, 0, 0.2, 1)
ease-incubic-bezier(0.4, 0, 1, 1)
ease-outcubic-bezier(0, 0, 0.2, 1)
ease-springcubic-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

Importhidden statevisible stateUse for
fadeUpopacity: 0, y: 24opacity: 1, y: 0Scroll reveals, card entrances
fadeDownopacity: 0, y: -24opacity: 1, y: 0Dropdowns, top-to-bottom UI
fadeInopacity: 0opacity: 1Subtle content reveals
slideInFromLeftopacity: 0, x: -24opacity: 1, x: 0Side panels, drawers
slideInFromRightopacity: 0, x: 24opacity: 1, x: 0Side panels, drawers
zoomInopacity: 0, scale: 0.95opacity: 1, scale: 1Modals, focused overlays
spinopacity: 0, rotate: -180, scale: 0.95opacity: 1, rotate: 0, scale: 1Playful icon reveals
staggerContainer(none)staggerChildren: 0.1Parent 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.

ImportBehaviourUse for
pageTransitionFades up on enter, fades down on exit (300ms)Route transitions, sections
modalTransitionScales 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 */