Hover Effects
Use hover utilities to add polished interaction states without writing custom CSS. FrontAlign hover classes cover color changes, elevation, movement, rotation, image filters, and opacity changes with the same utility-first naming style used across the framework.
Hover utilities are pure CSS and do not require the FrontAlign runtime.
Quick reference
| Group | Classes | Use case |
|---|---|---|
Hover background | hover:bg-* | Change the background color of buttons, cards, nav items, and interactive blocks. |
Hover text | hover:text-* | Change link, button, icon, or label color on hover. |
Hover shadow | hover:shadow-* | Add depth to cards, panels, dropdown triggers, and call-to-action blocks. |
Hover scale | hover:scale-* | Grow or shrink elements for tactile, clickable feedback. |
Hover translate | hover:translate-* | Move elements horizontally or vertically during interaction. |
Hover rotate | hover:rotate-* | Add expressive motion for badges, icons, media elements, and playful UI. |
Hover filters | hover:brightness-*, hover:grayscale | Enhance image previews, galleries, thumbnails, and portfolio cards. |
Hover opacity | hover:opacity-* | Fade content, overlays, controls, and visual states on hover. |
Usage
Apply hover classes directly beside the base utility classes. The base class defines the normal state, and the hover: class defines the interactive state.
<button className="button transition bg-primary hover:bg-dark text-white hover:text-light">Hover Me</button>
<div className="p-4 bg-slate-100 transition transform hover:translate-y-2">
Premium feature card
</div>
<img src="/project.jpg" class="hover:scale-105 hover:brightness-110" alt="Project" />
Premium feature card
Hover background colors
Use background hover utilities for buttons, cards, menu items, banners, and clickable surfaces.
<button class="bg-primary hover:bg-dark text-white">
Primary Button
</button>
<button class="bg-light hover:bg-primary">
Interactive Card
</button>
| Class | Effect | Recommended use |
|---|---|---|
hover:bg-primary | background-color | Primary actions and brand emphasis. |
hover:bg-success | background-color | Positive actions, confirmations, and success states. |
hover:bg-danger | background-color | Danger actions, destructive buttons, and warnings. |
hover:bg-warning | background-color | Attention states and warning surfaces. |
hover:bg-info | background-color | Informational buttons and callouts. |
hover:bg-light | background-color | Soft hover states on dark or bordered elements. |
hover:bg-dark | background-color | Strong contrast for primary buttons and CTAs. |
hover:bg-white | background-color | Clean hover states on dark surfaces. |
Hover palette colors
Use palette-based hover backgrounds when you need direct color families instead of semantic tokens.
<div class="hover:bg-blue">Blue hover</div>
<div class="hover:bg-green">Green hover</div>
<div class="hover:bg-red">Red hover</div>
<div class="hover:bg-purple">Purple hover</div>
<div class="hover:bg-orange">Orange hover</div>
<div class="hover:bg-yellow">Yellow hover</div>
<div class="hover:bg-teal">Teal hover</div>
<div class="hover:bg-indigo">Indigo hover</div>
<div class="hover:bg-slate">Slate hover</div>
Hover text colors
Use text hover utilities for links, icons, badges, nav items, and compact actions.
<a href="#" class="link text-body hover:text-primary">
Read More
</a>
<a href="#" class="link text-dark hover:text-danger">
Remove item
</a>
| Group | Classes | Use case |
|---|---|---|
Semantic text | hover:text-primary, hover:text-success, hover:text-danger, hover:text-warning, hover:text-info | Use for meaningful UI states and brand-driven interactions. |
Neutral text | hover:text-light, hover:text-dark, hover:text-white | Use for contrast control on buttons, cards, and dark sections. |
Palette text | hover:text-blue, hover:text-green, hover:text-red, hover:text-purple, hover:text-orange, hover:text-yellow, hover:text-teal, hover:text-indigo, hover:text-slate | Use when a design needs direct palette-level color selection. |
Hover shadows
Use hover shadows to add elevation when an element receives interaction.
<div class="bg-slate-100 rounded-3 transition-shadow hover:shadow-large">
Card Content
</div>
Card Content
| Class | Effect | Use case |
|---|---|---|
hover:shadow-tiny | Small elevation | Subtle hover feedback for compact elements. |
hover:shadow | Default elevation | General cards, buttons, and small panels. |
hover:shadow-medium | Medium elevation | Feature cards, pricing boxes, and product tiles. |
hover:shadow-large | Large elevation | Premium cards, large panels, and hero elements. |
Hover scale
Use scale utilities to make elements feel clickable. Small values like hover:scale-105 are usually the most professional for production interfaces.
<div class="transition-transform hover:scale-105 my-4 transform hover:scale-105">
Hover Card
</div>
Card Content
| Class | Value | Behavior |
|---|---|---|
hover:scale-75 | 0.75 | Shrinks strongly on hover. |
hover:scale-90 | 0.90 | Shrinks softly on hover. |
hover:scale-95 | 0.95 | Creates a pressed or compact feel. |
hover:scale-100 | 1.00 | Returns an element to normal size. |
hover:scale-105 | 1.05 | Creates a subtle premium lift. |
hover:scale-110 | 1.10 | Creates stronger interactive emphasis. |
hover:scale-125 | 1.25 | Creates a bold zoom effect for media or playful UI. |
Hover translate Y
Use vertical translation to create floating cards and polished lift effects.
<div class="translate-transform transform hover:translate-y-2">
Interactive Card
</div>
Interactive Card
| Direction | Classes | Use case |
|---|---|---|
Positive Y | hover:translate-y-1, hover:translate-y-2, hover:translate-y-3, hover:translate-y-4 | Move the element downward on hover. |
Negative Y | hover:-translate-y-1, hover:-translate-y-2, hover:-translate-y-3, hover:-translate-y-4 | Lift the element upward on hover. |
Hover translate X
Use horizontal translation for arrows, links, list items, and slide-style interactions.
<div class="transition-transform transform hover:translate-x-2">
Slide Interaction
</div>
Interactive Card
| Direction | Classes | Use case |
|---|---|---|
Positive X | hover:translate-x-1, hover:translate-x-2, hover:translate-x-3, hover:translate-x-4 | Move the element to the right on hover. |
Negative X | hover:-translate-x-1, hover:-translate-x-2, hover:-translate-x-3, hover:-translate-x-4 | Move the element to the left on hover. |
Hover rotation
Use rotation for expressive interfaces. For business UI, keep values small and intentional.
<div class="w-24 h-24 transition-transform transform hover:rotate-3">
Badge
</div>
| Class | Rotation | Use case |
|---|---|---|
hover:rotate-1 | 1deg | Very subtle icon or badge movement. |
hover:rotate-2 | 2deg | Soft expressive tilt. |
hover:rotate-3 | 3deg | Visible but controlled hover motion. |
hover:rotate-12 | 12deg | Playful badges and decorative objects. |
hover:rotate-45 | 45deg | Strong icon or control transitions. |
hover:rotate-90 | 90deg | Directional controls and toggles. |
hover:rotate-180 | 180deg | Flip-style indicators and icon states. |
Hover brightness
Use brightness hover utilities for images, thumbnails, hero media, and gallery previews.
<img src="/hero.jpg" class="transition hover:brightness-110" alt="Hero" />
| Class | Effect | Use case |
|---|---|---|
hover:brightness-75 | Darker | Dim images or overlays on hover. |
hover:brightness-90 | Slightly darker | Subtle darkening for image cards. |
hover:brightness-110 | Slightly brighter | Premium image lift and gallery hover states. |
hover:brightness-125 | Brighter | Strong emphasis for thumbnails and visual previews. |
Hover grayscale
Use grayscale utilities for image reveal effects and editorial card layouts.
<img src="/team.jpg" class="transition hover:grayscale" alt="Team" />
<img src="/member.jpg" class="transition hover:grayscale-none" alt="Team Member" />
| Class | Effect | Use case |
|---|---|---|
hover:grayscale | Apply grayscale | Mute images on hover for editorial or gallery effects. |
hover:grayscale-none | Remove grayscale | Reveal full-color images on hover. |
Hover opacity
Use opacity utilities for overlays, secondary actions, icons, and soft hover states.
<div class="transition-opacity hover:opacity-75">
Content
</div>
| Class | Opacity | Use case |
|---|---|---|
hover:opacity-0 | 0 | Hide content on hover. |
hover:opacity-25 | 0.25 | Fade content strongly. |
hover:opacity-50 | 0.50 | Create half-transparent hover states. |
hover:opacity-75 | 0.75 | Use as a soft fade for icons and controls. |
hover:opacity-95 | 0.95 | Subtle fade with almost full visibility. |
hover:opacity-100 | 1 | Restore full opacity on hover. |
Real-world examples
Premium card
Combine shadow and vertical movement for a polished card interaction.
<div class="transotion-all border rounded-4 hover:shadow-large hover:translate-y-2">
Premium Feature Card
</div>
Interactive CTA
Combine background, text, and shadow utilities for a strong call-to-action state.
<a href="#" class="transition bg-primary hover:bg-dark text-white hover:text-white hover:shadow-medium">
Get Started
</a>
Portfolio image
Combine scale and brightness for media previews, project grids, and gallery cards.
<img src="/project.jpg" class="transition hover:scale-105 hover:brightness-110" alt="Project" />
Team member card
Use grayscale utilities when the normal state is muted and the hover state should reveal the full image.
<img src="/member.jpg" class="transition grayscale hover:grayscale-none" alt="Team Member" />
Usage notes
- Use subtle hover effects for professional interfaces.
- Combine shadow and negative translate effects for premium floating cards.
- Combine scale and brightness for image galleries, portfolios, and product grids.
- Use hover text and background colors for links, buttons, nav items, and CTAs.
- Avoid excessive rotation in business interfaces unless the brand language is playful.
- Prefer small transform values for smooth and controlled interactions.
- Keep hover states meaningful; they should communicate interactivity, not only decoration.