← Home v1.3.0

Docs / Components / Hero button

Hero button

A sparkle call-to-action button for landing pages: a dark pill that turns brand-coloured on hover, with twinkling stars, a spark line round the edge and particles. No GSAP, respects reduced motion.

Hero button

A sparkle call-to-action button: a dark pill that turns brand-coloured on hover, with twinkling stars, a spark line running round the edge and particles streaming out. Use it once per page, for the main call to action in a hero. Everywhere else, use ace-btn--primary.

Get started
<button class="ace-hero-btn">Book a demo</button>

<!-- Effects (sparkle icon, spark line, particles): -->
<script src="ace-hero.js" defer></script>

<!-- Works on links too; any colour via --ace-tone -->
<a class="ace-hero-btn" href="/signup" style="--ace-tone:#2563eb">Get started</a>

<!-- Without the sparkle icon -->
<button class="ace-hero-btn" data-no-icon>Book a demo</button>

<!-- Markup added later (Vue / React / HTMX): -->
AceHero.init(container)
Do
  • Use it for the single most important action on a landing page ("Book a demo", "Get started").
  • Keep the label short (one to three words), so it fits on one line.
Don't
  • Put two hero buttons on one screen, or use it inside forms, dialogs or tables.
  • Worry about motion-sensitive visitors: with "reduce motion" on, it keeps the colours but drops the movement.

Use it

One stylesheet and one script from the CDN, pinned to v1.3.0:

<link rel="stylesheet" href="https://acecss.dev/v1.3.0/ace.min.css"
      integrity="sha384-zHAwOqjifsc0D+iUvzD1a4W0R2g0BOK9AqQJZGakUEp/Tm5IUcP07R9xkY0q/stj" crossorigin="anonymous">
<script src="https://acecss.dev/v1.3.0/ace-hero.min.js" defer
        integrity="sha384-9GbyxTfs2krubP46OnEkVVYjds58yGjr3EF3P1CAujQqzY/qB9ccrF7YIQIaWif5" crossorigin="anonymous"></script>

Or from npm:

npm i @acecss/core

import '@acecss/core'
import '@acecss/core/hero'

Bundlers, Tailwind, every script in one file and self-hosting: Install.

More components