Ir al contenido
Español
Lista escalonada viene con Pro. La vista previa aparece al desbloquearlo.

Cómo funciona

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.

Úsalo para

  • 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.

Busca otra opción cuando

  • 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.

Uso

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>
      )}
    />
  )
}

Propiedades

PropiedadTipoPor defectoQué hace
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.

Accesibilidad

  • 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.

Movimiento

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.

Añádelo a tu proyecto

Los miembros Pro copian un prompt y su agente de programación instala el código, igual que con los gratuitos.

StaggerList.jsxstagger-list.csstokens.cssREADME.md

Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.

Listas
Carrusel en arco viene con Pro. La vista previa aparece al desbloquearlo.
Carrusel cilíndrico viene con Pro. La vista previa aparece al desbloquearlo.