Playground

Animated list

A list whose items enter one by one without shifting the layout.

  • Built on native elements
  • A real <ul> with <li> items, so list semantics and counts are announced.
  • Items fade in with opacity only and keep their space from the first frame; there is no layout shift.
  • With prefers-reduced-motion all items are visible at once.
  • Styles in one file: animated-list.css

Import

import '@monoline/css';
import {AnimatedList} from '@monoline/react';

Not installed yet? Pick a route.

Copies the source and its styles into your project.

npx monoline add animated-list

Usage

import {AnimatedList} from '@monoline/react';

const row = (t: string, d: string) => (
  <div style={{display: 'grid', gap: 'var(--s1)', padding: 'var(--s3) var(--s4)', border: '1px solid var(--rule)'}}>
    <strong>{t}</strong><span style={{color: 'var(--muted)', fontSize: 'var(--text-sm)'}}>{d}</span>
  </div>
);

<AnimatedList style={{display: 'grid', gap: 'var(--s2)', maxWidth: '24rem'}}>
  {row('Build passed', 'main, 2 minutes ago')}
  {row('Review requested', 'Docs update, 5 minutes ago')}
  {row('Deploy finished', 'Production, 9 minutes ago')}
</AnimatedList>

Examples

Activity

Props

AnimatedListProps

PropTypeDefaultDescription
intervalnumber300Milliseconds between one item entering and the next. Default 300.

Data Attributes

State is exposed through attributes. Style it with these selectors, not with class toggles.

This component sets no state attributes.

CSS classes

ClassStylesheet
.animated-listanimated-list.css
.animated-list-itemanimated-list.css

Customization

Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.

app.css
.animated-list {
  border-color: var(--accent);
}

Accessibility

  • A real <ul> with <li> items, so list semantics and counts are announced.
  • Items fade in with opacity only and keep their space from the first frame; there is no layout shift.
  • With prefers-reduced-motion all items are visible at once.