本文へ移動
日本語
「順次表示リスト」は Pro に含まれます。解除するとプレビューが表示されます。

仕組み

On first appearance each item enters after index × stagger ms: it rises, settles from a 0.97 scale and un-blurs from 6px over 560ms, touching only transform, opacity and filter. Items added later open their height with grid-template-rows 0fr to 1fr, then their content rises in. On removal, new and old data are merged during render, the item fades out, collapses, and only then is removed. Gaps are padding, so nothing leaves a seam. The component only moves items; the row look is yours.

向いている場面

  • Notification lists and activity feeds where items arrive and leave.
  • Result lists that change with a filter or search.
  • The first view of a card list that should feel assembled rather than dumped.

向かない場面

  • Very long or virtualized lists: only the first few items stagger, and virtualization breaks the exit merge.
  • Lists that refresh often: constant motion becomes noise.
  • Tables where people compare rows: use plain updates.

使い方

import { StaggerList } from './StaggerList.jsx'

export function Notices({ list, onDelete }) {
  return (
    <StaggerList
      items={list}
      getKey={(n) => n.id}
      stagger={40}
      renderItem={(n) => (
        <div className="notice">
          {n.title}
          <button onClick={() => onDelete(n.id)}>Delete</button>
        </div>
      )}
    />
  )
}

プロパティ

プロパティ型既定値説明
itemsT[]—List data. To delete, just remove the item from the array; the component handles the exit animation.
getKey(item: T, index: number) => Key—Unique key of each item, used to tell additions from removals.
renderItem(item: T, index: number) => ReactNode—Renders one item.
staggernumber40Delay between the entrances of neighbouring items, in ms.
distancenumber12Entrance movement in px.
direction'up' | 'left''up'Entrance direction: from below, or from the right.
staggerLimitnumber8From which item on the delay stops growing, to cap the total time of long lists.
gapnumber8Space between items in px; it collapses along with an item.
replayKeyKey—Changing it makes all current items enter again, staggered.
onExited(key: Key) => void—Called after an item finished exiting and was removed from the DOM.
as'ul' | 'ol' | 'div''ul'Root tag. With ul or ol each item is an li.
...restHTMLAttributes<HTMLElement>—Other attributes go to the root element, such as aria-label, aria-live and className.

アクセシビリティ

  • An item that is exiting is aria-hidden and inert, so it cannot be reached while it disappears.
  • If focus is inside a deleted item, it moves to the next item, then the previous one, then the list, so keyboard users keep their place.
  • A fallback timer removes items even when animations are disabled or the element is hidden.
  • Reduced motion shows the final state at once: no fade, movement or stagger, and removed items disappear immediately.
  • Give the root an aria-label, and aria-live if new items should be announced.

モーション

First entrance 560ms with the reveal curve (cubic-bezier(0.22, 1, 0.36, 1)), 40ms apart, up to 8 items. Added: height 280ms ease-out, content 420ms (60ms later). Removed: fade 180ms ease-in, then collapse 240ms starting at 160ms.

プロジェクトに追加

Pro メンバーはプロンプトをコピーし、コーディングエージェントが無料コンポーネントと同じ手順でソースを導入します。

StaggerList.jsxstagger-list.csstokens.cssREADME.md

2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。

リスト
「アーチ型カルーセル」は Pro に含まれます。解除するとプレビューが表示されます。
「円柱カルーセル」は Pro に含まれます。解除するとプレビューが表示されます。