Gradient Text .mv-gradient-text

Texto com gradiente multicolorido em CSS puro: estático, animado de um lado para o outro, esmaecimento editorial ou uma aurora de manchas coloridas que flutuam dentro das letras.

CategoriaTexto animado
TipoCSS puro (.mv-gradient-text)
Statusestável
Keywordsgradient, aurora, heading, colorful, hero, background-clip

When to use

  • A hero headline or keyword needs multi-color emphasis without images
  • A title should draw attention with a moving gradient or aurora blobs drifting inside the letters
  • An editorial heading should fade out toward the bottom

Avoid when

  • Body text or small labels; gradients lower contrast and legibility at small sizes
  • A light sheen sweeping over muted text, such as a loading label, is wanted → use Shimmer Text instead
  • Text sits on a moving or unpredictable background and must stay readable → use Adaptive Ink instead

Instalação

node scripts/add.mjs gradient-text --out ./src/marvelous

Agente de IA com o servidor MCP do Marvelous UI: install_components({ slugs: ["gradient-text"], target_dir: "<absolute path>/src/marvelous", framework: "react" }).

Arquivos copiados (dependências incluídas): tokens/tokens.css, core/base.css, components/gradient-text/gradient-text.css.

Uso

Marcação de referência, para usar como ponto de partida e personalizar com atributos, data-* e variáveis CSS:

<div style="display:grid;gap:1.6rem;justify-items:center;text-align:center;max-width:44rem">
  <h2 style="margin:0;font:800 clamp(2rem,5vw,3.2rem)/1.05 var(--mv-font-sans);letter-spacing:-.04em">
    Interfaces that <span class="mv-gradient-text" data-animate>captivate</span>.
  </h2>

  <p style="margin:0;font:800 clamp(2.4rem,6vw,4rem)/1 var(--mv-font-sans);letter-spacing:-.05em">
    <span class="mv-gradient-text" data-variant="aurora">Imagine without limits</span>
  </p>

  <h3 class="mv-gradient-text" data-variant="fade" style="margin:0;font:700 clamp(1.5rem,3.5vw,2.2rem)/1.15 var(--mv-font-sans);letter-spacing:-.03em">
    The design system for your whole team
  </h3>

  <div style="display:flex;gap:2.5rem;flex-wrap:wrap;justify-content:center">
    <div>
      <div class="mv-gradient-text" data-animate data-glow style="--mv-gradient-text-colors:#22d3ee,#a78bfa,#f472b6;--mv-gradient-text-glow:#a78bfa;font:800 2.4rem/1 var(--mv-font-sans);letter-spacing:-.03em">+38%</div>
      <div style="font-size:.8rem;color:var(--mv-fg-muted);margin-top:.35rem">conversions</div>
    </div>
    <div>
      <div class="mv-gradient-text" data-animate="y" style="--mv-gradient-text-colors:var(--mv-success),var(--mv-info),var(--mv-success);font:800 2.4rem/1 var(--mv-font-sans);letter-spacing:-.03em">99.99%</div>
      <div style="font-size:.8rem;color:var(--mv-fg-muted);margin-top:.35rem">uptime</div>
    </div>
  </div>
</div>

API

Attributes

NameTipoDescription
data-animate(empty) | y | hoverAnimates the gradient horizontally, vertically, or only on hover.
data-variantfade | aurorafade: a heading that fades out toward the bottom; aurora: blurry blobs in motion (--mv-gradient-text-c1…c4).
data-glowbooleanGlowing halo around the letters.

CSS classes

NameDescription
mv-gradient-textOn a heading or a span. When text wraps, each line gets its own gradient.

CSS variables

NameDefaultDescription
--mv-gradient-text-colorsaccent, pink, amberComma-separated list of colors (stop positions accepted).
--mv-gradient-text-angle90degGradient angle.
--mv-gradient-text-duration6s (aurora: 10s)Duration of one pass.
--mv-gradient-text-c1 … c4accent, pink, warning, infoBlob colors of the aurora variant.
--mv-gradient-text-glowvar(--mv-accent)Halo color (data-glow).

Accessibility

Real text, selectable and read normally. Pick colors that contrast with the background: the lightest one determines legibility. Reduced motion: static gradient.

Esta página foi traduzida com IA. Informar um problema de tradução