Skip to content
Guest
Tailwind CSS · Course Syllabus Show lessons
Interactivity · 8 min read · Beginner

Hover, Focus-Visible, Group & Peer States

Craft tactile buttons, interactive cards, and zero-JS form states using Tailwind state modifiers.

What you'll learn

  • Animate child icons on parent hover using `group` + `group-hover:`
  • React to checkbox/input states without JS using `peer` + `peer-checked:`
  • Style disabled buttons cleanly with `disabled:opacity-50 disabled:cursor-not-allowed`

Overview

Craft tactile buttons, interactive cards, and zero-JS form states using Tailwind state modifiers.

Code Example

<a href="/courses" class="group flex items-center justify-between rounded-2xl border p-5 transition hover:border-blue-500">
  <span class="font-bold group-hover:text-blue-600">Explore Tracks</span>
  <span class="transition group-hover:translate-x-1">-&gt;</span>
</a>

Key Takeaways

  • Animate child icons on parent hover using group + group-hover:
  • React to checkbox/input states without JS using peer + peer-checked:
  • Style disabled buttons cleanly with disabled:opacity-50 disabled:cursor-not-allowed

Quick Check

Check Your Understanding

Score: 0 / 1

1. What is the difference between `focus:` and `focus-visible:`?

Study Workspace

Finished this lesson?

Your progress is saved locally in your browser, no account needed.

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind