Skip to content

shadcn/ui animations not working on Tailwind v4

Dialogs and accordions without animation mean a missing tw-animate-css or shadcn/tailwind.css import. Why the second one fails silently, and how to check.

Updated 23 November 2026Tested with
  • shadcn 4.23.0
  • Tailwind CSS 4.3.5
  • Vite 8
  • React 19.3

If shadcn/ui dialogs, sheets, popovers and accordions open and close without any animation on Tailwind CSS v4, one of two imports is missing from your main CSS file: @import "tw-animate-css"; or @import "shadcn/tailwind.css";. The build passes without either, which is why this takes people an afternoon to find. Here's how to tell which one, and the less common causes after that.

Check the two imports

A project made with shadcn init on CLI 4.23 starts like this:

src/index.cssCSS
@import "tailwindcss";@import "tw-animate-css";@import "shadcn/tailwind.css";

Each does a different job:

  • tw-animate-css defines the animation utilities the components use: animate-in, animate-out, fade-in-0, zoom-in-95, slide-in-from-top-2 and animate-accordion-down.
  • shadcn/tailwind.css ships with the shadcn package. It defines the accordion keyframes and the data-open:, data-closed:, data-checked: and similar variants that the components put those animations behind.

We removed each import in turn from a working project with a Dialog and an Accordion, rebuilt it and counted what was left in the CSS:

CSS file hasanimate-in rulesAccordion keyframesWhat you see
Both importsyesyesFade, zoom and slide work
No tw-animate-cssnonenoneEverything appears and disappears instantly
No shadcn/tailwind.cssgenerated, but behind the wrong selectorpartlySame: no animation, no error

Why a missing shadcn/tailwind.css fails silently

This one is worth understanding, because it also explains odd behaviour in components you write yourself. Tailwind v4 has a built-in data-* variant: data-open: means "when the element has a data-open attribute". Without shadcn's stylesheet, that's what you get:

Terminal
grep -o '\.data-open\\:animate-in[^{]*{' dist/assets/*.css.data-open\:animate-in[data-open]{

Radix doesn't set data-open. It sets data-state="open". So the rule exists and never matches. With the import back, shadcn's variant covers both conventions (Radix's data-state and Base UI's data-open):

Terminal
grep -o '\.data-open\\:animate-in[^{]*{' dist/assets/*.css.data-open\:animate-in:where([data-state=open]),.data-open\:animate-in:where([data-open]:not([data-open=false])){

The fix: put the import back, and make sure the shadcn package is still in your dependencies. People remove it because it looks like a CLI they only run with npx; the stylesheet lives in it.

Other causes

The old tailwindcss-animate plugin

Projects from before March 2025 used tailwindcss-animate, a v3 plugin. shadcn/ui replaced it with tw-animate-css. Uninstall the old one, install the new one and import it as above:

npm install tw-animate-css

Then remove @plugin "tailwindcss-animate"; or the plugins entry from an old config, if you have one.

Not a cause: reduced motion

We checked the built CSS of our test project: the dialog and accordion animations don't look at the operating system's reduce-motion setting at all, so that setting won't switch them off. If you want it respected, and we think you should, add motion-reduce:animate-none to the animated elements, or a global rule under @media (prefers-reduced-motion: reduce).

A component copied from an older version

Older shadcn components wrote data-[state=open]:animate-in instead of data-open:animate-in. Both work with the imports in place. If you mix components from different versions and only some animate, compare their class strings with npx shadcn@latest add dialog --diff; updating components shows how to take the new version without losing your edits.

Questions

Do I need tailwindcss-animate with Tailwind v4?

No. Use tw-animate-css, a pure CSS replacement you import in your stylesheet. No plugin, no config.

Why is my accordion jumping open instead of sliding?

The slide uses animate-accordion-down, which needs both imports: the utility from tw-animate-css and the keyframes with the panel height variable from shadcn/tailwind.css.

Is this related to other Tailwind v4 problems?

Often. If more than animations look off, go through shadcn not working with Tailwind v4.

Was this page helpful?

Still stuck? We answer every message ourselves. Write to us

This page is built from UI Pro parts: the docs article block (docs-quernly) with the code, terminal, install command, steps, contents and feedback components. They ship in the next UI Pro release; the install command and the contents rail are free.