motionkit.byHizmedia (opens hizmedia.com in a new tab)
ComponentsTheme StudioPage BuilderPricing

Start building with motion.

206 animated React components, free to browse and customise. Plus unlocks every premium one, with a 14-day free trial.

Browse componentsSee Plus
motionkit.

Animated React components for people who love the details. Built with TypeScript, Tailwind CSS and Motion.

  • Hizmedia on Instagram (opens in a new tab)
  • Hizmedia on LinkedIn (opens in a new tab)
  • Hizmedia on YouTube (opens in a new tab)

Product

  • Components
  • Theme Studio
  • Page Builder
  • MotionKit Plus
  • What's new

Components

  • Backgrounds
  • Text effects
  • Buttons
  • Cards
  • Sections
  • All 206 components

Resources

  • Guides
  • Free tools
  • Free components
  • For shadcn/ui
  • Liquid glass
  • Hero sections

Company

  • About
  • Cookie policy
  • Your account
  • Hizmedia (opens in a new tab)
  • Start a project

motionkit.

© 2026 Hizmedia (opens hizmedia.com in a new tab)· Designed and built in the UK

RSS Back to top
    1. Guides
    2. Fundamentals

    Custom Animations in Tailwind CSS v4: Keyframes, Easing and Enter Effects

    Add custom animations in Tailwind CSS v4 with @theme: keyframes, animate-* classes, custom easing curves, enter animations with starting:, reduced motion, and when to switch to Motion.

    HHizmediaUpdated 14 November 20267 min read
    On this page
    1. 01The built-in animations
    2. 02Defining a custom animation with @theme
    3. 03Transitions and custom easing
    4. 04Animate elements in as they appear with starting:
    5. 05Staggering a list
    6. 06Reduced motion
    7. 07When to reach for Motion instead

    Tailwind CSS v4 moved configuration from tailwind.config.js into your CSS, and animations moved with it. Custom keyframes, animation classes and easing curves are now defined in an `@theme` block, and new utilities cover things that used to need JavaScript, like animating an element in as it appears. This guide covers each piece, with code you can paste.

    Free toolCubic-bezier generatorDrag an easing curve, race it against linear and ease, and copy it as CSS, Tailwind or Motion.

    01The built-in animations#

    Tailwind ships four animations: animate-spin for loaders, animate-ping for notification dots, animate-pulse for skeletons and animate-bounce for scroll hints. For anything else, you define your own.

    02Defining a custom animation with @theme#

    In v4, an animation is a theme variable named --animate-*, with its keyframes declared alongside it. Tailwind then generates a matching class:

    app/globals.css
    @import "tailwindcss";
    
    @theme {
      --animate-wiggle: wiggle 1s ease-in-out infinite;
      --animate-fade-up: fade-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    
      @keyframes wiggle {
        0%, 100% { transform: rotate(-3deg); }
        50% { transform: rotate(3deg); }
      }
    
      @keyframes fade-up {
        from { opacity: 0; transform: translateY(12px); }
        to { opacity: 1; transform: none; }
      }
    }

    Now animate-wiggle and animate-fade-up work anywhere, including with variants like hover:animate-wiggle. Keyframes inside @theme are only output when a class uses them, so unused animations cost nothing.

    For a one-off, an arbitrary value skips the theme: animate-[wiggle_1s_ease-in-out_infinite], with underscores where the spaces go.

    03Transitions and custom easing#

    Most interface motion is transitions rather than keyframes: transition (or transition-transform, transition-colors), plus duration-*, ease-* and delay-*. Tailwind's built-in curves are ease-linear, ease-in, ease-out and ease-in-out. Add your own as --ease-* theme variables:

    app/globals.css
    @theme {
      --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
      --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    card.tsx
    <div className="transition-transform duration-500 ease-out-quint hover:-translate-y-1">…</div>

    A strong ease-out like this makes hover effects feel quick and settled. To design a curve by eye, drag one in the free cubic-bezier generator, which outputs the Tailwind class and the @theme line. Easing functions explained covers which curve suits which job.

    04Animate elements in as they appear with starting:#

    Fading in a dialog or popover used to need JavaScript, because the element goes from display: none to visible in one step. CSS's @starting-style gives the browser a starting point, and Tailwind v4 exposes it as the starting: variant. Pair it with transition-discrete so display can transition too:

    menu.tsx
    <button popoverTarget="menu">Open menu</button>
    <div
      id="menu"
      popover="auto"
      className="scale-95 opacity-0 transition-all transition-discrete duration-200 open:scale-100 open:opacity-100 starting:open:scale-95 starting:open:opacity-0"
    >
      …
    </div>

    The menu now scales and fades in when it opens, and back out when it closes, with no JavaScript. The same pattern works for <dialog>.

    05Staggering a list#

    delay-* sets transition-delay, so for keyframe animations use an arbitrary property instead, setting the delay from each item's index:

    list.tsx
    {items.map((item, index) => (
      <li key={item.id} className="animate-fade-up" style={{ animationDelay: `${index * 60}ms` }}>
        {item.label}
      </li>
    ))}

    Keep the step between 40 and 80 milliseconds: shorter and it reads as one block, longer and the last items feel late. More in stagger animations in React.

    06Reduced motion#

    Tailwind's motion-safe: and motion-reduce: variants follow the visitor's operating system setting. Either opt in to motion, or switch it off:

    hero.tsx
    <h1 className="motion-safe:animate-fade-up">…</h1>
    <div className="animate-wiggle motion-reduce:animate-none">…</div>

    A good rule: anything that loops or moves a large area should stop under motion-reduce:, while small fades can stay. The accessible animation checklist has the rest.

    07When to reach for Motion instead#

    Tailwind and CSS cover hover states, loops, entrances and simple sequences (Motion vs CSS animations compares the two in detail). Switch to Motion when the animation needs to react to input: springs that carry the speed of a drag, elements animating out before React removes them, layout changes, gestures and scroll-linked values. Most real interfaces use both, which is how every MotionKit component is built: Tailwind for styling and static states, Motion for the parts that move with physics.

    Put it into practice

    Components from this guide

    • Shimmer ButtonA dark button with a light sweep that draws the eye without shouting.
    • MarqueeA seamless infinite scroller for logos and testimonials that pauses on hover.
    • Gradient TextHeadline text with a slowly flowing, seamlessly looping gradient.
    • MeteorsShooting stars streaking across a dotted sky at scattered times.

    Questions

    Where is tailwind.config.js in Tailwind v4?+

    It's optional now. Theme values, including animations, keyframes and easing curves, go in an @theme block in your CSS. A JavaScript config still works through the @config directive if you need it.

    How do I add keyframes in Tailwind CSS v4?+

    Declare an --animate-name variable and its @keyframes inside @theme in your CSS file. Tailwind generates an animate-name class for it.

    Can Tailwind animate an element when it's removed?+

    Only for elements the browser hides itself, like a closing popover or dialog, using transition-discrete. Elements React removes from the page need a library like Motion to animate out.

    Does Tailwind support spring animations?+

    Not natively, but a CSS linear() easing can trace a spring curve. Generate one with a spring generator and use it as a custom --ease-* value or in an arbitrary ease-[…] class.

    PreviousPage Transitions in the Next.js App Router with View TransitionsNext Exit Animations in React: AnimatePresence and Why Yours Isn't Working

    On this page

    1. The built-in animations
    2. Defining a custom animation with @theme
    3. Transitions and custom easing
    4. Animate elements in as they appear with starting:
    5. Staggering a list
    6. Reduced motion
    7. When to reach for Motion instead

    Found this useful? Send it to someone building with motion.

    Keep reading

    All guides
    • Fundamentals·6 min read

      Easing Functions Explained: cubic-bezier in CSS and Motion

      What easing curves are, what ease-in, ease-out and ease-in-out really mean, how cubic-bezier works and which curve to use when, with a live curve editor.

      Read guide
    • Fundamentals·9 min read

      Motion (Framer Motion) vs CSS Animations in React: Which to Use When

      Should you animate with CSS or Motion (Framer Motion) in React? Compare performance, bundle size, springs, exits and gestures, with code for both.

      Read guide
    • Fundamentals·5 min read

      Stagger Animations in React with Motion

      How to stagger animations in React with Motion's stagger(): lists, grids and text, starting from the first, last or centre item, and how long to make them.

      Read guide