Skip to main content
196

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
Visual guides / Motion

Keep changes easy to follow.

Animate list changes, transitions, and feedback while preserving focus and stable item identities.

Use motion to explain a change: reordered tasks, a new result, or a selected view. Keep routine updates short.

Loading the interactive workbench…

Start building

Load your adapter stylesheet once. Astro needs its client runtime for enhanced interactions; React manages its own lifecycle; Elements needs client registration.

astro
---
// pnpm add @santi020k/lumen-astro
// In your root layout:
import '@santi020k/lumen-astro/styles.css'
import UIPrimitives from '@santi020k/lumen-astro/runtime'
---
<slot />
<UIPrimitives />

Starter example

The React example includes local state. Astro and Elements show the component structure; your client code owns data updates and event handlers.

tsx
'use client'

import { useState } from 'react'
import { Button, Card, MotionGroup } from '@santi020k/lumen-react'

export function TaskList() {
  const [tasks, setTasks] = useState(['Plan', 'Review', 'Ship'])
  return <>
    <Button onClick={() => setTasks(current => [...current].reverse())}>
      Reverse order
    </Button>
    <MotionGroup duration="standard">
      {tasks.map(task => <Card key={task} data-ui-motion-key={task}>{task}</Card>)}
    </MotionGroup>
  </>
}

Adapter setup: Astro · React · Elements.

Before you ship

  • Give every direct child a unique, stable data-ui-motion-key. React keys and DOM motion keys serve different purposes; use both.
  • Your application owns the list order and render. Missing or duplicate identities skip ambiguous animation.
  • System reduced motion wins. Add data-ui-motion="reduce" to a subtree for an immediate comparison.
  • View transitions need one unique view-transition-name per surface. Await asynchronous rendering inside runLumenViewTransition.

Component reference

Find props, events, keyboard behavior, and Astro, React, and Elements examples for each primitive.

For optional Motion and Rive integrations, see the motion playground.

Next: Effects
Web docsFull catalog