Logo hdtoledo
hdtoledo.dev
Módulos_del_Sistema
MÓDULO_TEÓRICO

Micro-interactions and Interactive States

Micro-interactions

The Difference Between a Boring Site and a Premium Experience

Micro-interactions are subtle visual cues that deliver instant feedback when a user interacts with a button, input, or card. They make interfaces feel alive, responsive, and tactile.

In this lesson, we will transform our Login form and Dashboard metric cards with smooth transitions, hover effects, and focused neon glow states.


1. Interactive Pseudo-classes

  • :hover: Triggered when the pointer glides over an element.
  • :focus-visible: Triggered when focused via keyboard or click (vital for accessibility).
  • :active: Triggered at the exact moment of mouse down / click.
  • :disabled: Styles applied when an element is inactive.

2. The Power of transition

Never change visual properties abruptly. Smooth them out using transition:

css
/* Cyberpunk Button with Micro-interactions */ .btn-access { position: relative; background: var(--primary); color: #05050f; border: none; padding: 14px 28px; font-weight: 700; border-radius: var(--radius-sm); cursor: pointer; /* Smooth transform and shadow curves */ transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background-color 0.2s ease; } /* Hover State: Slight lift and radiant glow */ .btn-access:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 0 25px var(--primary-glow); background-color: #38f8ff; } /* Active State: Compresses upon click */ .btn-access:active { transform: translateY(1px) scale(0.98); }

3. Neon Focus Rings for Form Inputs

css
.form-group input:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.25); background-color: #121524; }

4. Floating Metric Cards on Hover

css
.metric-card { background: var(--bg-card); border: 1px solid var(--border-glow); border-radius: var(--radius-md); padding: 24px; transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease; } .metric-card:hover { border-color: var(--primary); transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0, 240, 255, 0.1); }