infinity-track
loading-ui/infinity-trackFreeComponent
@loading-ui publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by @loading-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://loading-ui.com/r/infinity-track.jsonSource
1import { cn } from "@/lib/utils";23const INFINITY_TRACK_BLOCKS = ["█", "▓", "▒"] as const;45type InfinityTrackProps = React.ComponentProps<"span"> & {6 blocks?: readonly string[];7 track?: string;8};910function InfinityTrack({11 className,12 blocks = INFINITY_TRACK_BLOCKS,13 track = "░",14 ...props15}: InfinityTrackProps) {16 const glyphs = INFINITY_TRACK_BLOCKS.map(17 (_, index) => blocks[index] ?? INFINITY_TRACK_BLOCKS[index],18 );19 const gridCells = Array.from({ length: 45 }, (_, index) => {20 const row = Math.floor(index / 9);21 const col = index % 9;2223 return row === 0 || row === 4 || col === 0 || col === 4 || col === 824 ? track25 : " ";26 });2728 return (29 <>30 <style>{`31 @keyframes loading-ui-infinity-track {32 0%,33 100% {34 transform: translate(4ch, 0);35 }3637 12.5% {38 transform: translate(0, 0);39 }4041 25% {42 transform: translate(0, 4ch);43 }4445 37.5% {46 transform: translate(4ch, 4ch);47 }4849 50% {50 transform: translate(4ch, 0);51 }5253 62.5% {54 transform: translate(8ch, 0);55 }5657 75% {58 transform: translate(8ch, 4ch);59 }6061 87.5% {62 transform: translate(4ch, 4ch);63 }64 }65 `}</style>66 <span67 role="status"68 className={cn(69 "relative inline-flex h-[5ch] w-[9ch] overflow-hidden font-mono text-xl leading-none text-current select-none",70 className,71 )}72 {...props}73 >74 <span75 aria-hidden="true"76 className="pointer-events-none absolute inset-0 grid grid-cols-9 grid-rows-5"77 >78 {gridCells.map((glyph, index) => (79 <span80 key={index}81 className="flex h-[1ch] w-[1ch] items-center justify-center"82 >83 {glyph}84 </span>85 ))}86 </span>87 {glyphs.map((glyph, index) => (88 <span89 key={`${glyph}-${index}`}90 aria-hidden="true"91 className={cn(92 "pointer-events-none absolute top-0 left-0 flex h-[1ch] w-[1ch] items-center justify-center",93 ["z-30", "z-20", "z-10"][index],94 )}95 style={{96 animation:97 "loading-ui-infinity-track var(--duration, 3.2s) linear infinite",98// … truncated
Files it writes
More from @loading-ui
All 50 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordion-loaderaccordion-loader | @loading-ui | Components | Free | no deps | |
| analyzing-imageanalyzing-image | @loading-ui | Components | Free | 1 dep | |
| arcarc | @loading-ui | Components | Free | no deps | |
| barsbars | @loading-ui | Components | Free | no deps | |
| bobbing-dotsbobbing-dots | @loading-ui | Components | Free | 1 dep | |
| bouncing-dotsbouncing-dots | @loading-ui | Components | Free | no deps | |
| classicclassic | @loading-ui | Components | Free | no deps | |
| clock-ringclock-ring | @loading-ui | Components | Free | no deps |
