infinite-ribbon
jolyui-ui/infinite-ribbonFreeComponent
jolyui/ui publishes no description for this item.
Install it
npx shadcn@latest add https://jolyui.dev/r/infinite-ribbon.jsonSource
1import type * as React from "react";23import { cn } from "@/lib/utils";45export interface InfiniteRibbonProps {6 repeat?: number;7 duration?: number;8 reverse?: boolean;9 rotation?: number;10 children: React.ReactNode;11 className?: string;12}1314const ribbonAnimationStyles = `15@keyframes iconiq-infinite-ribbon {16 from {17 transform: translateX(0);18 }19 to {20 transform: translateX(-50%);21 }22}2324@keyframes iconiq-infinite-ribbon-reverse {25 from {26 transform: translateX(-50%);27 }28 to {29 transform: translateX(0);30 }31}3233@media (prefers-reduced-motion: reduce) {34 .iconiq-infinite-ribbon-track {35 animation-duration: 1ms !important;36 animation-iteration-count: 1 !important;37 }38}39`;4041export function InfiniteRibbon({42 repeat = 5,43 duration = 10,44 reverse = false,45 rotation = 0,46 children,47 className,48}: InfiniteRibbonProps) {49 const repeatCount = Math.max(1, Math.floor(repeat));50 const animationName = reverse51 ? "iconiq-infinite-ribbon-reverse"52 : "iconiq-infinite-ribbon";5354 return (55 <div56 className={cn(57 "w-full max-w-full overflow-hidden bg-foreground py-1 text-background text-lg",58 className59 )}60 style={{ transform: `rotate(${rotation}deg)` }}61 >62 <span className="sr-only">{children}</span>63 <div64 aria-hidden="true"65 className="iconiq-infinite-ribbon-track flex w-max whitespace-nowrap"66 style={67 {68 "--ribbon-duration": `${Math.max(0.1, duration)}s`,69 animation: `${animationName} var(--ribbon-duration) linear infinite`,70 } as React.CSSProperties71 }72 >73 {Array.from({ length: repeatCount * 2 }, (_, index) => (74 <span className="mr-8 inline-block select-none" key={index}>75 {children}76 </span>77 ))}78 </div>79 <style>{ribbonAnimationStyles}</style>80 </div>81 );82}
Files it writes
More from jolyui/ui
All 199 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| ai-prompt-boxai-prompt-box | jolyui/ui | Components | Free | 4 deps | |
| animated-beamanimated-beam | jolyui/ui | Components | Free | 1 dep | |
| animated-tableanimated-table | jolyui/ui | Components | Free | 2 deps | |
| animated-theme-toggleanimated-theme-toggle | jolyui/ui | Components | Free | 2 deps | |
| animated-toastanimated-toast | jolyui/ui | Components | Free | 2 deps | |
| animated-tooltipanimated-tooltip | jolyui/ui | Components | Free | 1 dep | |
| bento-gridbento-grid | jolyui/ui | Components | Free | no deps | |
| buttonbutton | jolyui/ui | Components | Free | 3 deps |
