Tailwind CSS transition-shadow Class
The transition-shadow utility class generates the following CSS when applied to an element.
CSS Output
.transition-shadow {
transition-property: box-shadow;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
}Variants
Use these variant prefixes to apply transition-shadow conditionally:
Use It
<div class="transition-shadow shadow hover:shadow-xl duration-200 rounded-lg p-4 bg-white">
Shadow grows on hover
</div>Understanding transition-shadow
The Tailwind CSS transition-shadow utility applies transition-property: box-shadow; to an element when added to its class attribute. It enables transitions only on box-shadow changes. Ideal for cards and buttons that change shadow depth on hover or focus.
This utility is part of Tailwind's Transitions module, designed for adding smooth CSS transitions with configurable duration, timing, and property targeting. In Tailwind's utility-first workflow, you add transition-shadow directly to your HTML elements rather than writing custom CSS. This approach accelerates development and keeps styles co-located with your markup, making it easy to see exactly how each element is styled at a glance.
Common responsive variants include sm:transition-shadow, md:transition-shadow, lg:transition-shadow, and xl:transition-shadow, allowing different behavior at each breakpoint. State variants like hover:transition-shadow and focus:transition-shadow enable interactive styling without any JavaScript. You can also combine multiple variants for fine-grained control over when the utility applies.
This class works well alongside `transition`, `shadow`, `shadow-lg`, `duration-200` to build complete, production-ready interfaces. Tailwind's tree-shaking ensures only utilities you actually use appear in your final CSS bundle, keeping file sizes minimal. Browser support for the underlying CSS is excellent across Chrome, Firefox, Safari, and Edge.
Related Classes
transitiontransition-property: color, background-color, border-color,
shadowbox-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
shadow-lgbox-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
duration-200transition-duration: 200ms;
ease-in-outtransition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
Explore More Tailwind Classes
Browse our complete reference of 321 Tailwind CSS utility classes with CSS output, variants, and examples.