axi0motion

Doc folder

A folder whose papers peek out under the pointer and fan out above it when it opens; each paper is a link you can pick.

  • enhancer
  • folder
  • files
  • disclosure
  • hover
  • cards
  • 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

Doc folder example

Controls

200 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>

<div data-motion="doc-folder" aria-label="Project files">
  <a href="#">Launch plan</a>
  <a href="#">Brand guide</a>
  <a href="#">Moodboard</a>
</div>

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

Options

AttributeDefaultWhat it does
data-motion-size200the folder's width
data-motion-colorautothe folder's color (empty: the accent)
data-motion-labelFolderthe button's name when the element has no aria-label

Accessibility

- The folder is a button with the element's label, aria-expanded and aria-controls; the papers are the page's own links (or buttons) in a list. - Closed, the papers are inert: they only peek out. Open, Tab reaches each one; Escape or a click outside closes the folder and Escape puts focus back on it. - The folder keeps room above it for the open fan, so opening it never moves the page. - Reduced motion opens and closes it at once. Reduced motion shows every state at once, with no movement, and stops anything that would move on its own. Frame loops and CSS animations pause off screen and in hidden tabs. Only transform, opacity and paint animate, so nothing around it moves.

Size

doc-folder.js is 1.7 KB gzip, with components-kit.js 3.9 KB it needs. A page loads the loader (2.7 KB) and core.js (1.4 KB) once, whatever it uses.