Button Effects .mv-button

Sept effets pour .mv-button via data-effect : étincelle en orbite, bordure arc-en-ciel, pulsation, touche 3D, reflet qui balaie, flèche révélée et halo.

CatégoriePrimitives
TypeCSS seul (.mv-button)
Statutstable
Installe aussibutton
Keywordsbutton, shimmer, rainbow, pulse, pushable, 3d, shine, arrow, glow, cta

When to use

  • A hero or pricing call to action must stand out with a shine, glow, rainbow border or orbiting spark
  • A tactile 3D key press or a revealed arrow adds character to a single primary action

Avoid when

  • Many buttons on the page or a dense app interface, where animated effects compete for attention → use Button instead
  • The button should be pulled toward the cursor rather than restyled → use Magnetic instead
  • The action is destructive and needs a deliberate confirmation → use Hold Button instead

Installation

node scripts/add.mjs button-effects --out ./src/marvelous

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

Fichiers copiés (dépendances comprises) : tokens/tokens.css, core/base.css, components/button-effects/button-effects.css, components/button/button.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:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,13rem),1fr));gap:2rem 1.5rem;width:100%;max-width:56rem;margin:auto;justify-items:center;align-items:center;text-align:center">
  <div style="display:grid;gap:.6rem;justify-items:center">
    <button class="mv-button" data-effect="shimmer" data-shape="pill" data-size="lg">Start free trial</button>
    <code style="font-size:.75rem;color:var(--mv-fg-muted)">shimmer</code>
  </div>
  <div style="display:grid;gap:.6rem;justify-items:center">
    <button class="mv-button" data-effect="rainbow" data-size="lg">Get access</button>
    <code style="font-size:.75rem;color:var(--mv-fg-muted)">rainbow</code>
  </div>
  <div style="display:grid;gap:.6rem;justify-items:center">
    <button class="mv-button" data-effect="pulse" data-size="lg">Join the livestream</button>
    <code style="font-size:.75rem;color:var(--mv-fg-muted)">pulse</code>
  </div>
  <div style="display:grid;gap:.6rem;justify-items:center">
    <button class="mv-button" data-effect="push" data-size="lg">Place order</button>
    <code style="font-size:.75rem;color:var(--mv-fg-muted)">push</code>
  </div>
  <div style="display:grid;gap:.6rem;justify-items:center">
    <button class="mv-button" data-effect="shine" data-size="lg">Download the app</button>
    <code style="font-size:.75rem;color:var(--mv-fg-muted)">shine (hover)</code>
  </div>
  <div style="display:grid;gap:.6rem;justify-items:center">
    <button class="mv-button" data-effect="arrow" data-variant="outline" data-shape="pill" data-size="lg"><span>Explore</span></button>
    <code style="font-size:.75rem;color:var(--mv-fg-muted)">arrow (hover)</code>
  </div>
  <div style="display:grid;gap:.6rem;justify-items:center">
    <button class="mv-button" data-effect="glow" data-size="lg">Publish</button>
    <code style="font-size:.75rem;color:var(--mv-fg-muted)">glow</code>
  </div>
  <div style="display:grid;gap:.6rem;justify-items:center">
    <button class="mv-button" data-effect="push" data-variant="outline" data-size="lg">Cancel</button>
    <code style="font-size:.75rem;color:var(--mv-fg-muted)">push + outline</code>
  </div>
</div>

API

Attributes

NameTypeDescription
data-effectshimmer | rainbow | pulse | push | shine | arrow | glowshimmer: dark fill with a conic spark orbiting the edge; rainbow: inverted fill with a moving rainbow border and glow; pulse: an expanding ring; push: 3D key (lifts on hover, sinks on press); shine: a light band on hover/focus; arrow: a dot floods the button, the label slides and an arrow appears (label inside a <span>); glow: colored halo that intensifies on hover. Combines with data-variant, data-size, data-shape.

CSS variables

NameDefaultDescription
--mv-button-shimmer-color / -bg / -size / -durationwhite / violet ink / 1.5px / 3sSpark, background, glowing edge thickness, duration of one lap.
--mv-button-rainbow / -fill / -duration5 hues / var(--mv-fg) / 3sGradient (loops: first = last color), fill, duration.
--mv-button-pulse-color / -size / -durationaccent / 0.8rem / 1.8sPulse ring.
--mv-button-edge / --mv-button-liftdarkened fill / 4pxPush: edge color and height.
--mv-button-shine-colorwhite 50%Shine: highlight color.
--mv-button-floodaccentArrow: flood color.
--mv-button-glow-coloraccentGlow: halo color.

Accessibility

Stays a real <button> (focus, keyboard, disabled, aria-busy). Hover effects (shine, arrow) also trigger on keyboard focus. Under reduced motion, shimmer/rainbow/pulse stop and transitions become instant.

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