Repository navigation
Replies: 7 comments
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as low quality.
This comment was marked as low quality.
|
You're reading this correctly — The exact current definition of
|
| What you want to transition | Use |
|---|---|
| Shadow size/color/style | transition-shadow |
| Text/background/border colors | transition-colors |
| Both colors and shadows | transition (the base utility, which includes both) |
| Everything | transition-all |
The base transition utility includes box-shadow alongside colors, opacity, transforms, and filters — so if you want both shadow and color transitions together, transition is the right choice rather than combining transition-colors and transition-shadow.
Practical example
<!-- Transitioning shadow only -->
<button class="shadow-sm hover:shadow-lg transition-shadow duration-300">
Hover me
</button>
<!-- Transitioning both color and shadow -->
<button class="bg-blue-500 shadow-sm hover:bg-indigo-500 hover:shadow-lg transition duration-300">
Hover me
</button>So there is no gap here — shadows are fully transitionable, just via transition-shadow or the base transition, not transition-colors. The separation keeps each utility semantically accurate to what it names.
Hope this helps — if it answers your question, would you mind clicking "Mark as answer" so others searching for the same thing can find it quickly?
|
Yes, this is intentional. The Why shadows are excluded:
How to transition shadows: Use <!-- Transition only shadow -->
<div class="transition-shadow shadow-lg hover:shadow-xl">
<!-- Transition everything -->
<div class="transition-all shadow-lg hover:shadow-xl">
<!-- Transition specific properties -->
<div class="transition-[box-shadow] shadow-lg hover:shadow-xl">Custom transition with shadows: /* Custom transition that includes shadow */
.my-element {
transition-property: color, background-color, border-color, box-shadow;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
}Or in Tailwind: <div class="transition-[color,background-color,border-color,box-shadow]">Performance tip: If you need smooth shadow transitions, consider using |
|
mate if i wanted to talk to chatgpt i would not come here |
|
This is intentional — box-shadow is not a color-only property. It's a shorthand for
If you need the shadow color to animate alongside other color properties, use <div class="transition-[color,background-color,box-shadow] ..."> |
|
You're reading it right. As of v4.3.3, transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;Source: tailwindcss/packages/tailwindcss/src/utilities.ts Lines 4813 to 4820 in f7f47f8 The reason is how shadow colors work. tailwindcss/packages/tailwindcss/src/utilities.ts Lines 5565 to 5570 in f7f47f8 The gradient stops are different. They're registered as tailwindcss/packages/tailwindcss/src/utilities.ts Lines 2984 to 2986 in f7f47f8 The only way to animate a shadow color is to transition tailwindcss/packages/tailwindcss/src/utilities.ts Lines 4826 to 4830 in f7f47f8 So the fix is to pick the utility that covers what you're changing: <!-- shadow color only -->
<div class="shadow-lg shadow-blue-500 hover:shadow-red-500 transition-shadow">
<!-- text/bg/border colors and shadow together: plain `transition` covers both -->
<div class="bg-white hover:bg-blue-50 shadow-lg shadow-blue-500 hover:shadow-red-500 transition">
<!-- or name exactly what you want -->
<div class="transition-[color,background-color,border-color,box-shadow] ...">Note that I checked this in Chrome with Tailwind v4.3.3. I swapped |
Uh oh!
There was an error while loading. Please reload this page.
Hi, if I'm reading about
transition-colorshere:https://tailwindcss.com/docs/transition-property
It seems that
shadow-*andinset-shadow-*are not included in thistransition-colorsproperty. Is there a reason for this?All reactions