Logos Carousel
spell-ui/logos-carouselFreeComponent
Animated carousel component that cycles through sets of logos with staggered animations.
Live preview
live · rendered by the registry
Rendered by spell-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://spell.sh/r/logos-carousel.jsonSource
1"use client";23import * as React from "react";4import { cn } from "@/lib/utils";56export interface LogosCarouselProps {7 children: React.ReactNode;8 stagger?: number;9 count?: number;10 className?: string;11 duration?: number;12 interval?: number;13 initialDelay?: number;14}1516export function LogosCarousel({17 children,18 stagger = 0.14,19 count,20 className,21 duration = 600,22 interval = 2500,23 initialDelay = 500,24}: LogosCarouselProps) {25 const [index, setIndex] = React.useState(0);26 const [animate, setAnimate] = React.useState(false);27 const [nextIndex, setNextIndex] = React.useState(1);2829 const childrenArray = React.Children.toArray(children);30 const logosPerGroup = count || childrenArray.length;31 const groups: React.ReactNode[][] = [];3233 for (let i = 0; i < childrenArray.length; i += logosPerGroup) {34 groups.push(childrenArray.slice(i, i + logosPerGroup));35 }3637 const groupsLength = groups.length;3839 React.useEffect(() => {40 const id = setTimeout(() => {41 setAnimate(true);42 }, initialDelay);4344 return () => {45 clearTimeout(id);46 };47 }, [initialDelay]);4849 React.useEffect(() => {50 if (!animate || groupsLength === 0) {51 return;52 }5354 function loop() {55 setIndex((prevIndex) => {56 const newIndex = (prevIndex + 1) % groupsLength;57 setNextIndex((newIndex + 1) % groupsLength);58 return newIndex;59 });60 }6162 const intervalId = setInterval(loop, interval);6364 return () => {65 clearInterval(intervalId);66 };67 }, [animate, interval, groupsLength]);6869 if (groupsLength === 0) {70 return null;71 }7273 return (74 <>75 <style jsx>{`76 @keyframes logos-enter {77 0% {78 transform: translateY(40px);79 filter: blur(4px);80 opacity: 0;81 }82 100% {83 transform: translateY(0);84 filter: blur(0px);85 opacity: 1;86 }87 }8889 @keyframes logos-exit {90 0% {91 transform: translateY(0);92 filter: blur(0px);93 opacity: 1;94 }95 100% {96 transform: translateY(-40px);97 filter: blur(4px);98 opacity: 0;99 }100 }101 `}</style>102 <div103 className="max-w-[720px] grid place-items-center w-full"104 >105 {groups.map((group, groupIndex) => {106 const isCurrent = groupIndex === index;107 const isNext = groupIndex === nextIndex && animate;108// … truncated
Files it writes
More from spell-ui
All 33 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Checkboxanimated-checkbox | spell-ui | Components | Free | 1 dep | |
| Animated Gradientanimated-gradient | spell-ui | Components | Free | no deps | |
| Badgebadge | spell-ui | Components | Free | 2 deps | |
| Bars Spinnerbars-spinner | spell-ui | Components | Free | no deps | |
| Blur Revealblur-reveal | spell-ui | Components | Free | 1 dep | |
| Chartchart | spell-ui | Components | Free | no deps | |
| Color Selectorcolor-selector | spell-ui | Components | Free | no deps | |
| Copy Buttoncopy-button | spell-ui | Components | Free | 1 dep |
