axi0motion

Proximity list

List items lean out and light up as the pointer passes near them.

  • enhancer
  • hover
  • pointer
  • navigation
  • list
  • 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.

Controls

80 px
16 px

Code

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

<link rel="stylesheet" href="/axi0/motion/motion.css?v=6">
<script src="/axi0/motion/motion.js?v=10" defer></script>

<nav class="m-proximity-list" aria-label="Sections"><ul data-motion="proximity-list">
  <li><a href="#proximity-list">Overview</a></li>
  <li><a href="#proximity-list" aria-current="page">Getting started</a></li>
  <li><a href="#proximity-list">Pointer effects</a></li>
  <li><a href="#proximity-list">Backgrounds</a></li>
  <li><a href="#proximity-list">Text</a></li>
  <li><a href="#proximity-list">Sounds</a></li>
  <li><a href="#proximity-list">Accessibility</a></li>
</ul></nav>

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

Options

AttributeDefaultWhat it does
data-motion-reach80how far, in pixels above and below, the pointer reaches
data-motion-shift16how far the nearest item leans out, in pixels
data-motion-color#f6a04dthe tick and highlight color

Accessibility

The lean is a transform and the highlight is paint, so the list never reflows, and the item text keeps its own color and contrast. Keyboard focus inside an item and aria-current hold an item fully lit. Reduced motion: no lean, the light alone shows nearness.

Size

proximity-list.js is 1.2 KB gzip. A page loads the loader (2.7 KB) and core.js (1.4 KB) once, whatever it uses.