Master state-based styling and user interactions
button class="hover:bg-indigo-700
focus:ring-2
active:translate-y-0.5"
Tailwind CSS provides a rich set of utilities for handling user interactions and states. These utilities help you create responsive, interactive UI elements without writing custom CSS. Let's explore the different interactivity features offered by Tailwind.
Apply styles when a user hovers over an element using the hover: prefix.
hover:bg-orange-500 hover:text-black
Apply styles when an element receives focus using the focus: prefix.
focus:bg-green-500 focus:text-black
Apply styles when an element is being activated (pressed) using the active: prefix.
active:bg-yellow-500 active:text-black
Style elements based on parent hover state using group and group-hover: prefixes.
This is some card text
group group-hover:text-white
Apply styles to alternating items in a list using even: and odd: prefixes.
even:bg-green-200 odd:bg-blue-200
Remove browser-specific styling from elements using appearance-none.
appearance-none
Control the cursor appearance when hovering over elements using cursor-{type} utilities.
cursor-pointer cursor-progress cursor-not-allowed
Tailwind provides many cursor utilities for different use cases:
cursor-auto
Browser default cursor
cursor-default
Standard cursor
cursor-pointer
Clickable element
cursor-wait
Program is busy
cursor-text
Text can be selected
cursor-move
Element can be moved
cursor-help
Help is available
cursor-not-allowed
Action not available
cursor-none
Cursor is hidden
cursor-progress
Program working
cursor-cell
Cell selection
cursor-crosshair
Precise selection
cursor-vertical-text
Vertical text
cursor-alias
Create alias/shortcut
cursor-copy
Can be copied
cursor-no-drop
Cannot be dropped
cursor-grab
Element can be grabbed
cursor-grabbing
Grabbing element
cursor-all-scroll
Scroll in any direction
cursor-col-resize
Resize column
cursor-row-resize
Resize row
cursor-n-resize
Resize north edge
cursor-e-resize
Resize east edge
cursor-s-resize
Resize south edge
cursor-w-resize
Resize west edge
cursor-ne-resize
Resize NE corner
cursor-nw-resize
Resize NW corner
cursor-se-resize
Resize SE corner
cursor-sw-resize
Resize SW corner
cursor-ew-resize
Resize east-west
cursor-ns-resize
Resize north-south
cursor-nesw-resize
Resize NE-SW diagonal
cursor-nwse-resize
Resize NW-SE diagonal
cursor-zoom-in
Content can be zoomed in
cursor-zoom-out
Content can be zoomed out
Control how users can select text using select-{type} utilities.