Loader
prompt-kit/loaderFreeComponent
A component for displaying a loading indicator with multiple variants and customizable styling
Live preview
live · rendered by the registry
Rendered by prompt-kit on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://raw.githubusercontent.com/ibelick/prompt-kit/HEAD/public/c/loader.jsonSource
1"use client"23import { cn } from "@/lib/utils"4import React from "react"56export interface LoaderProps {7 variant?:8 | "circular"9 | "classic"10 | "pulse"11 | "pulse-dot"12 | "dots"13 | "typing"14 | "wave"15 | "bars"16 | "terminal"17 | "text-blink"18 | "text-shimmer"19 | "loading-dots"20 size?: "sm" | "md" | "lg"21 text?: string22 className?: string23}2425export function CircularLoader({26 className,27 size = "md",28}: {29 className?: string30 size?: "sm" | "md" | "lg"31}) {32 const sizeClasses = {33 sm: "size-4",34 md: "size-5",35 lg: "size-6",36 }3738 return (39 <div40 className={cn(41 "border-primary animate-spin rounded-full border-2 border-t-transparent",42 sizeClasses[size],43 className44 )}45 >46 <span className="sr-only">Loading</span>47 </div>48 )49}5051export function ClassicLoader({52 className,53 size = "md",54}: {55 className?: string56 size?: "sm" | "md" | "lg"57}) {58 const sizeClasses = {59 sm: "size-4",60 md: "size-5",61 lg: "size-6",62 }6364 const barSizes = {65 sm: { height: "6px", width: "1.5px" },66 md: { height: "8px", width: "2px" },67 lg: { height: "10px", width: "2.5px" },68 }6970 return (71 <div className={cn("relative", sizeClasses[size], className)}>72 <div className="absolute h-full w-full">73 {[...Array(12)].map((_, i) => (74 <div75 key={i}76 className="bg-primary absolute animate-[spinner-fade_1.2s_linear_infinite] rounded-full"77 style={{78 top: "0",79 left: "50%",80 marginLeft:81 size === "sm" ? "-0.75px" : size === "lg" ? "-1.25px" : "-1px",82 transformOrigin: `${size === "sm" ? "0.75px" : size === "lg" ? "1.25px" : "1px"} ${size === "sm" ? "10px" : size === "lg" ? "14px" : "12px"}`,83 transform: `rotate(${i * 30}deg)`,84 opacity: 0,85 animationDelay: `${i * 0.1}s`,86 height: barSizes[size].height,87 width: barSizes[size].width,88 }}89 />90 ))}91 </div>92 <span className="sr-only">Loading</span>93 </div>94 )95}9697export function PulseLoader({98 className,99 size = "md",100}: {101 className?: string102 size?: "sm" | "md" | "lg"103}) {104 const sizeClasses = {105 sm: "size-4",106 md: "size-5",107 lg: "size-6",108 }109110 return (111 <div className={cn("relative", sizeClasses[size], className)}>112// … truncated
What it pulls in
Other registry items
Files it writes
More from prompt-kit
All 23 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Chain Of Thoughtchain-of-thought | prompt-kit | Components | Free | 1 dep | |
| Chat Containerchat-container | prompt-kit | Components | Free | 1 dep | |
| Code Blockcode-block | prompt-kit | Components | Free | 1 dep | |
| Feedback Barfeedback-bar | prompt-kit | Components | Free | 1 dep | |
| File Uploadfile-upload | prompt-kit | Components | Free | no deps | |
| Imageimage | prompt-kit | Components | Free | no deps | |
| Jsx Previewjsx-preview | prompt-kit | Components | Free | 1 dep | |
| Markdownmarkdown | prompt-kit | Components | Free | 5 deps · 2 files |
