For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
Shadcn Labs/

Animated List

A list whose items pop in, fade out and glide into place as they change. A React component built on View Transitions, installed with the shadcn CLI.

Inbox 6

  • Maya opened a pull requestfeat: keyboard shortcuts for the editor3m
  • Deploy finishedProduction is live at v2.14.012m
  • Jonas replied in #design“Can we ship this behind a flag?”26m
  • New issue in productionTypeError in checkout/summary.tsx48m
  • Payment receivedInvoice #1042 for $240.001h
  • New team memberPriya joined the Acme workspace3h

Installation

$ pnpm dlx shadcn@latest add @transition-kit/animated-list

Usage

import {
  AnimatedList,
  AnimatedListItem,
  useAnimatedList,
} from "@/components/transitions/animated-list";
const { items, add, remove, move, sort, set } = useAnimatedList([
  { id: 1, title: "Deploy finished" },
  { id: 2, title: "Payment received" },
]);
 
<AnimatedList aria-label="Notifications">
  {items.map((item) => (
    <AnimatedListItem key={item.id} id={item.id}>
      {item.title}
      <button type="button" onClick={() => remove(item.id)}>
        Dismiss
      </button>
    </AnimatedListItem>
  ))}
</AnimatedList>;
add({ id: 3, title: "New comment" }, 0); // insert at index 0 (default: end)
remove(2); // by id
move(1, 0); // move id 1 to index 0
sort((a, b) => a.title.localeCompare(b.title));
set((items) => items.filter((item) => !item.read)); // any update
startTransition(() => setItems((items) => items.slice(1)));

API Reference

AnimatedListItem

PropTypeDefaultDescription
idstring | number-Unique identity for the row, stable between renders. Render it with the same key.

useAnimatedList

ReturnTypeDescription
itemsT[]Current list contents.
add(item: T, index?: number) => voidInserts an item at the index (default: end).
remove(id: string | number) => voidRemoves the item with the given id.
move(id: string | number, index: number) => voidMoves the item with the given id to an index.
sort(compare: (a: T, b: T) => number) => voidReorders items with a compare function.
set(items: T[] | ((items: T[]) => T[])) => voidReplaces items with an array or an updater function.
const { items, add, remove, move, sort, set } = useAnimatedList(initial, {
  getId,
});