infinity-square-snake
loading-ui/infinity-square-snakeFreeComponent
@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-square-snake.jsonSource
1import { cn } from "@/lib/utils";23const INFINITY_SQUARE_SNAKE_BLOCKS = ["█", "▓", "▒", "░"] as const;45type InfinitySquareSnakeProps = React.ComponentProps<"span"> & {6 blocks?: readonly string[];7};89function InfinitySquareSnake({10 className,11 blocks = INFINITY_SQUARE_SNAKE_BLOCKS,12 ...props13}: InfinitySquareSnakeProps) {14 const glyphs = INFINITY_SQUARE_SNAKE_BLOCKS.map(15 (_, index) => blocks[index] ?? INFINITY_SQUARE_SNAKE_BLOCKS[index],16 );1718 return (19 <>20 <style>{`21 @keyframes loading-ui-infinity-square-snake {22 0%,23 100% {24 transform: translate(4ch, 0);25 }2627 12.5% {28 transform: translate(0, 0);29 }3031 25% {32 transform: translate(0, 4ch);33 }3435 37.5% {36 transform: translate(4ch, 4ch);37 }3839 50% {40 transform: translate(4ch, 0);41 }4243 62.5% {44 transform: translate(8ch, 0);45 }4647 75% {48 transform: translate(8ch, 4ch);49 }5051 87.5% {52 transform: translate(4ch, 4ch);53 }54 }55 `}</style>56 <span57 role="status"58 className={cn(59 "relative inline-flex h-[5ch] w-[9ch] overflow-hidden font-mono text-xl leading-none text-current select-none",60 className,61 )}62 {...props}63 >64 {glyphs.map((glyph, index) => (65 <span66 key={`${glyph}-${index}`}67 aria-hidden="true"68 className="pointer-events-none absolute top-0 left-0 flex h-[1ch] w-[1ch] items-center justify-center"69 style={{70 animation:71 "loading-ui-infinity-square-snake var(--duration, 3.2s) linear infinite",72 animationDelay: `calc(var(--delay, 0.1s) * -${glyphs.length - 1 - index})`,73 }}74 >75 {glyph}76 </span>77 ))}78 <span className="sr-only">Loading</span>79 </span>80 </>81 );82}8384export { InfinitySquareSnake };
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 |
