Mehi

Animated List

Component 3

About

A semantic list component whose items fade and slide in with a stagger, animate out cleanly on removal, and reorder smoothly via layout animation — for building live feeds, task lists, or activity logs.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Animated List to your project and fits it to your theme.

Code

How Animated List is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import * as React from "react";
import { AnimatedList, AnimatedListItem } from "@/components/ui/animated-list";

export default function AnimatedListDemo() {
  const [items, setItems] = React.useState([
    { id: 1, text: "Order #1042 shipped" },
    { id: 2, text: "New comment on your post" },
    { id: 3, text: "Server backup completed" },
  ]);
  const nextId = React.useRef(4);

  const addItem = () => {
    setItems((prev) => [
      ...prev,
      { id: nextId.current++, text: `New notification #${nextId.current}` },
    ]);
  };

  const removeItem = (id: number) => {
    setItems((prev) => prev.filter((item) => item.id !== id));
  };

  return (
    <div className="flex w-full max-w-sm flex-col gap-4">
      <button
        onClick={addItem}
        className="self-start rounded-md border border-[var(--color-border,#e4e7ec)] px-3 py-1.5 text-sm font-medium text-[var(--color-fg,#111318)] transition-colors hover:bg-[var(--color-surface,#fff)]"
      >
        Add item
      </button>
      <AnimatedList>
        {items.map((item, index) => (
          <AnimatedListItem
            key={item.id}
            index={index}
            onClick={() => removeItem(item.id)}
            className="cursor-pointer"
          >
            {item.text}
          </AnimatedListItem>
        ))}
      </AnimatedList>
    </div>
  );
}

Dependencies

More by Mehi

View all
  • Border Beam Panel

    Border Beam Panel

    929
  • Compare Reveal

    Compare Reveal

    304
  • Decrypt Text

    Decrypt Text

    240
  • Holo Card

    Holo Card

    220
  • Magnetic Dock

    Magnetic Dock

    157
  • Luminous Topography

    Luminous Topography

    106
  • Lens Card

    Lens Card

    83
  • Copperplate Hatch

    Copperplate Hatch

    59