agyanadda@gmail.com

Tailwind Shadows and Rings

Styling and Effects 1 min read Updated Dec 1, 2026 Topic 15 of 27

Box shadows

shadow-2xs, shadow-xs, shadow-sm, shadow-md, shadow-lg, shadow-xl, shadow-2xl, shadow-none

(In v4 the old shadow-sm is now shadow-xs, and old shadow is shadow-sm.)

Coloured shadows

shadow-lg shadow-indigo-500/40 — a soft glow under buttons.

Inset shadow

inset-shadow-sm — a pressed-in look.

Rings

A ring is an outline made with box-shadow — perfect for focus states and avatar borders:

  • ring-2 ring-indigo-500
  • ring-offset-2 — space between element and ring
  • focus:ring-2 — show only when focused

Opacity

opacity-50, opacity-75, hover:opacity-100 — fade whole elements.

Hover lift effect

shadow-sm hover:shadow-xl transition makes cards feel clickable.

Example

Example — Shadows and rings HTML
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

<div class="p-8 bg-slate-50 grid grid-cols-2 sm:grid-cols-4 gap-6">
  <div class="bg-white p-4 rounded-lg shadow-xs">shadow-xs</div>
  <div class="bg-white p-4 rounded-lg shadow-md">shadow-md</div>
  <div class="bg-white p-4 rounded-lg shadow-xl">shadow-xl</div>
  <div class="bg-white p-4 rounded-lg shadow-sm hover:shadow-2xl transition cursor-pointer">hover me</div>
  <button class="bg-indigo-600 text-white rounded-lg px-4 py-2 shadow-lg shadow-indigo-500/50">Glow button</button>
  <img src="https://picsum.photos/id/65/80/80" class="size-16 rounded-full ring-4 ring-amber-400 ring-offset-2" alt="Avatar">
  <input class="border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-sky-500 col-span-2" placeholder="Focus for a ring">
</div>

Test Yourself With Exercises

Exercise 1 Multiple Choice

Which utility is best for a focus outline around an input?

Exercise 2 True / False

shadow-indigo-500/50 gives a coloured shadow at 50% opacity.

Exercise 3 Fill in the Blank

ring-___-2 adds space between an element and its ring.

Frequently Asked Questions

A border takes up space and can shift the layout. A ring does not, so it is better for focus and selected states.