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

GroupClassesUse case
Hover backgroundhover:bg-*Change the background color of buttons, cards, nav items, and interactive blocks.
Hover texthover:text-*Change link, button, icon, or label color on hover.
Hover shadowhover:shadow-*Add depth to cards, panels, dropdown triggers, and call-to-action blocks.
Hover scalehover:scale-*Grow or shrink elements for tactile, clickable feedback.
Hover translatehover:translate-*Move elements horizontally or vertically during interaction.
Hover rotatehover:rotate-*Add expressive motion for badges, icons, media elements, and playful UI.
Hover filtershover:brightness-*, hover:grayscaleEnhance image previews, galleries, thumbnails, and portfolio cards.
Hover opacityhover: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>
ClassEffectRecommended use
hover:bg-primarybackground-colorPrimary actions and brand emphasis.
hover:bg-successbackground-colorPositive actions, confirmations, and success states.
hover:bg-dangerbackground-colorDanger actions, destructive buttons, and warnings.
hover:bg-warningbackground-colorAttention states and warning surfaces.
hover:bg-infobackground-colorInformational buttons and callouts.
hover:bg-lightbackground-colorSoft hover states on dark or bordered elements.
hover:bg-darkbackground-colorStrong contrast for primary buttons and CTAs.
hover:bg-whitebackground-colorClean 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>
GroupClassesUse case
Semantic texthover:text-primary, hover:text-success, hover:text-danger, hover:text-warning, hover:text-infoUse for meaningful UI states and brand-driven interactions.
Neutral texthover:text-light, hover:text-dark, hover:text-whiteUse for contrast control on buttons, cards, and dark sections.
Palette texthover: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-slateUse 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

ClassEffectUse case
hover:shadow-tinySmall elevationSubtle hover feedback for compact elements.
hover:shadowDefault elevationGeneral cards, buttons, and small panels.
hover:shadow-mediumMedium elevationFeature cards, pricing boxes, and product tiles.
hover:shadow-largeLarge elevationPremium 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

ClassValueBehavior
hover:scale-750.75Shrinks strongly on hover.
hover:scale-900.90Shrinks softly on hover.
hover:scale-950.95Creates a pressed or compact feel.
hover:scale-1001.00Returns an element to normal size.
hover:scale-1051.05Creates a subtle premium lift.
hover:scale-1101.10Creates stronger interactive emphasis.
hover:scale-1251.25Creates 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

DirectionClassesUse case
Positive Yhover:translate-y-1, hover:translate-y-2, hover:translate-y-3, hover:translate-y-4Move the element downward on hover.
Negative Yhover:-translate-y-1, hover:-translate-y-2, hover:-translate-y-3, hover:-translate-y-4Lift 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

DirectionClassesUse case
Positive Xhover:translate-x-1, hover:translate-x-2, hover:translate-x-3, hover:translate-x-4Move the element to the right on hover.
Negative Xhover:-translate-x-1, hover:-translate-x-2, hover:-translate-x-3, hover:-translate-x-4Move 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>
ClassRotationUse case
hover:rotate-11degVery subtle icon or badge movement.
hover:rotate-22degSoft expressive tilt.
hover:rotate-33degVisible but controlled hover motion.
hover:rotate-1212degPlayful badges and decorative objects.
hover:rotate-4545degStrong icon or control transitions.
hover:rotate-9090degDirectional controls and toggles.
hover:rotate-180180degFlip-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" />
ClassEffectUse case
hover:brightness-75DarkerDim images or overlays on hover.
hover:brightness-90Slightly darkerSubtle darkening for image cards.
hover:brightness-110Slightly brighterPremium image lift and gallery hover states.
hover:brightness-125BrighterStrong 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" />
ClassEffectUse case
hover:grayscaleApply grayscaleMute images on hover for editorial or gallery effects.
hover:grayscale-noneRemove grayscaleReveal 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>
ClassOpacityUse case
hover:opacity-00Hide content on hover.
hover:opacity-250.25Fade content strongly.
hover:opacity-500.50Create half-transparent hover states.
hover:opacity-750.75Use as a soft fade for icons and controls.
hover:opacity-950.95Subtle fade with almost full visibility.
hover:opacity-1001Restore 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.

FrontAlign