Glow .mv-glow

Rétroéclairage en dégradé flouté derrière n’importe quel élément, et carte néon à bordure en dégradé, statique ou en lente rotation.

CatégorieEffets
TypeCSS uniquement (.mv-glow)
Statutstable
Keywordsglow, backlight, neon, halo, gradient, blur, cta

When to use

  • A primary CTA, pricing card or product shot needs a colored backlight to stand out on a dark page
  • A highlighted card should be framed by a neon gradient ring with a halo, static or slowly rotating
  • A key element needs a halo that also intensifies on hover and keyboard focus

Avoid when

  • The emphasis should be light traveling along the border rather than a static halo → use Border Beam instead
  • The light should follow the cursor inside a card or across a grid → use Spotlight Card instead
  • Every card on the page would get a halo, so nothing stands out anymore

Installation

node scripts/add.mjs glow --out ./src/marvelous

Agent IA avec le serveur MCP Marvelous UI : install_components({ slugs: ["glow"], target_dir: "<absolute path>/src/marvelous", framework: "react" }).

Fichiers copiés (dépendances comprises) : tokens/tokens.css, core/base.css, components/glow/glow.css.

Utilisation

Balisage de référence : partez de celui-ci et personnalisez-le avec les attributs, data-* et les variables CSS :

<div style="display:flex;flex-wrap:wrap;gap:2.5rem;justify-content:center;align-items:center;width:100%;padding:1rem 0">
  <div class="mv-glow" data-variant="soft" data-animate style="width:min(100%,17rem)">
    <article class="mv-card">
      <header class="mv-card-header">
        <h3 class="mv-card-title">Creator plan</h3>
        <p class="mv-card-description">Soft, animated backlight</p>
      </header>
      <div class="mv-card-content">
        <div class="mv-card-stat">$19<span style="font-size:.9rem;font-weight:500;color:var(--mv-fg-muted)"> / month</span></div>
        <p style="margin:.5rem 0 0;color:var(--mv-fg-muted)">Custom domain, analytics, 100 GB of storage.</p>
      </div>
      <footer class="mv-card-footer"><button class="mv-button" style="width:100%">Choose this plan</button></footer>
    </article>
  </div>

  <div class="mv-glow" data-variant="neon" data-animate style="width:min(100%,17rem)">
    <article class="mv-card">
      <header class="mv-card-header">
        <h3 class="mv-card-title">Neon card</h3>
        <p class="mv-card-description">Gradient border and halo</p>
      </header>
      <div class="mv-card-content">
        <p style="margin:0;color:var(--mv-fg-muted)">Highlight the recommended plan or the latest announcement without cluttering the page.</p>
      </div>
      <footer class="mv-card-footer"><button class="mv-button" data-variant="outline" style="width:100%">Learn more</button></footer>
    </article>
  </div>

  <div style="display:grid;gap:1.5rem;justify-items:center">
    <span class="mv-glow" style="--mv-glow-radius:var(--mv-radius-full)">
      <button class="mv-button" data-shape="pill" data-size="lg">Join the waitlist</button>
    </span>
    <span class="mv-glow" style="--mv-glow-radius:var(--mv-radius-lg);--mv-glow-color-1:oklch(0.78 0.17 150);--mv-glow-color-2:oklch(0.82 0.14 200);--mv-glow-color-3:oklch(0.85 0.16 110)">
      <button class="mv-button" data-variant="outline" data-size="lg">Static glow, custom colors</button>
    </span>
  </div>
</div>

API

Attributes

NameTypeDefaultDescription
data-variantsoft | neon(tight halo)soft: wide, diffuse halo shifted downward; neon: gradient ring (padding = thickness) + neon halo.
data-animatebooleanSlow gradient rotation (disabled with reduced motion).

CSS classes

NameDescription
mv-glowWrapper (inline-grid) around the element to light up: the halo is painted behind the child, even when the child is opaque.

CSS variables

NameDefaultDescription
--mv-glow-color-1 / -2 / -3accent / pink / cyan (neon: magenta / cyan)Gradient colors.
--mv-glow-blur1.75remHalo blur.
--mv-glow-spread0.25remHalo spread around the element (negative = tighter).
--mv-glow-opacity0.55Intensity; +0.3 on hover and focus.
--mv-glow-radiusvar(--mv-radius-xl)Radius (match it to the child).
--mv-glow-border2pxNeon: ring thickness.
--mv-glow-duration8sDuration of one rotation (data-animate).

Accessibility

Purely decorative (content-less pseudo-elements). The halo also intensifies on keyboard focus. With reduced motion, rotation stops and the effect stays static.

Cette page a été traduite par IA. Signaler un problème de traduction