Animated List
Liste dont les elements s'animent sequentiellement avec une entree echelonnee. Installez Animated List depuis le registre VLLNT UI avec la CLI shadcn.
Liste dont les elements s'animent sequentiellement avec une entree echelonnee. Fait partie de la famille content dans VLLNT UI, il est publie comme entree de registre lisible par machine — copiez la source directement dans votre application avec la CLI shadcn et possedez-la, sans dependance d'execution a une bibliotheque de composants.
Apercu
Basculez entre clair et sombre pour inspecter l'apercu Storybook integre.
Installation
Ajoutez Animated List a votre projet avec la CLI shadcn. La source arrive dans votre code, prete a etre adaptee :
pnpm dlx shadcn@latest add https://ui.vllnt.ai/r/animated-list.jsonSource
import * as React from "react";
import { cn } from "../../lib/utils";
/** Props for {@link AnimatedList}. */
export type AnimatedListProps = React.ComponentPropsWithoutRef<"div"> & {
/** Stagger between item entrances in milliseconds. Defaults to `100`. */
delay?: number;
};
/**
* Wrapper that fades and slides its children in with a staggered delay.
*
* Respects `prefers-reduced-motion`: items appear without motion.
*
* @example
* ```tsx
* <AnimatedList>
* <span>First</span>
* <span>Second</span>
* </AnimatedList>
* ```
*/
export const AnimatedList = ({
children,
className,
delay = 100,
ref,
...props
}: AnimatedListProps & { ref?: React.Ref<HTMLDivElement> }) => {
const items = React.Children.toArray(children);
return (
<div className={cn("flex flex-col gap-2", className)} ref={ref} {...props}>
{items.map((child, index) => (
<span
className="block animate-in fade-in-0 slide-in-from-bottom-2 motion-reduce:animate-none"
key={index}
style={{
animationDelay: `${index * delay}ms`,
animationFillMode: "both",
}}
>
{child}
</span>
))}
</div>
);
};
AnimatedList.displayName = "AnimatedList";
Stories
Explorez chaque variante et etat dans le Storybook interactif :
Apercu
Basculez entre clair et sombre pour inspecter l'apercu Storybook integre.