Stagger Group
Stagger Group brings controlled expression to your interface.
Make it yours.
Install the editable source and its dependencies into your React + Tailwind project.
Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/stagger-group.jsonUse it
Scroll horizontally for long lines
"use client";
import { StaggerGroup } from "@/components/jez-ui/ui/stagger-group";
export default function Example() {
return (
<>
<StaggerGroup className="w-full max-w-md">
{[
"A thought worth keeping.",
"A shape worth exploring.",
"Something worth sharing.",
].map((t, i) => (
<div
key={t}
className="flex items-center gap-5 border-b border-border py-5"
>
<span className="grid size-10 shrink-0 place-items-center rounded-full bg-accent text-lg text-foreground">
{i + 1}
</span>
<p className="text-lg">{t}</p>
</div>
))}
</StaggerGroup>
</>
);
}
Props & types
Scroll horizontally for long lines
React.ComponentProps<typeof motion.div> & {
children: React.ReactNode;
className?: string;
}Source
View 2 source files
registry/ui/stagger-group.tsx
Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
import { motion, useReducedMotion } from "motion/react";
export function StaggerGroup({
children,
className,
...props
}: React.ComponentProps<typeof motion.div> & {
children: React.ReactNode;
className?: string;
}) {
const reduce = useReducedMotion();
return (
<motion.div
initial="hidden"
whileInView="shown"
viewport={{ once: true }}
transition={{ staggerChildren: reduce ? 0 : 0.1 }}
{...props}
className={cn("grid gap-3", className)}
>
{React.Children.map(children, (child) => (
<motion.div
variants={{
hidden: { opacity: reduce ? 1 : 0.3, y: reduce ? 0 : 16 },
shown: { opacity: 1, y: 0 },
}}
>
{child}
</motion.div>
))}
</motion.div>
);
}
registry/ui/utils.ts
Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
return twMerge(clsx(values));
}
Dependencies
motion@13.2.0 · clsx@2.1.1 · tailwind-merge@3.5.0
Accessibility & behaviour
Respect reduced-motion preferences. Decorative effects must not carry essential information. WebGL scenes include a static fallback and only render while visible.
Read the accessibility and performance guide →