axi0motion

Glint button

A glass button whose rim catches the light, with a highlight that glides toward the pointer and drifts round the edge at rest.

  • enhancer
  • button
  • glass
  • light
  • pointer
  • hover
  • since 0.2

Background Studio: tune it below, then copy the code

Your system asks for reduced motion: the demo shows its final state and nothing moves.

Live demo

Glint button example

Controls

160 px

Code

It follows the controls above: change an option and the code changes with it.

<script src="https://search.axi0.io/axi0/motion/motion.js" defer></script>

<div class="m-glint-demo"><span class="m-glint-blob" aria-hidden="true"></span><span class="m-glint-blob m-b2" aria-hidden="true"></span><button class="demo-btn" type="button" data-motion="glint-button">Get started</button></div>

The wrappers: GlintButton.tsx (React, TypeScript) and GlintButton.vue (Vue). Both render the same attributes as the HTML; the loader does the rest.

Options

AttributeDefaultWhat it does
data-motion-colorautoColor of the light (empty: white on dark pages, orange on light ones)
data-motion-reach160How far from the button the pointer still pulls the light
data-motion-idletrueLet the light drift round the rim when no pointer is near
data-motion-glasstrueGive the button the frosted glass look (off: keep the page's own look, add only the light)

Accessibility

The button stays the page's own button: same role, label and keys; the light is drawn with pseudo-elements that take no pointer events. Keyboard focus lights the top edge and shows a focus ring in the light's color. Touch: a tap brings the light under the finger. Only transform, opacity and paint change, so nothing around it moves. Frames run through the shared loop, which stops off screen, in hidden tabs and under reduced motion; reduced motion shows the final state with no movement.

Size

glint-button.js is 2.1 KB gzip. A page loads the loader (2.9 KB) and core.js (1.4 KB) once, whatever it uses.