Glass Skeleton
einui/glass-skeletonFreeComponent
A liquid glass styled skeleton loading component with shimmer.
Live preview
live · rendered by the registry
Rendered by einui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.eindev.ir/r/glass-skeleton.jsonSource
1"use client"23import * as React from "react"4import { motion } from "framer-motion"5import { cn } from "@/lib/utils"67interface GlassSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {8 variant?: "default" | "circular" | "text" | "card"9 width?: string | number10 height?: string | number11 lines?: number12}1314const GlassSkeleton = React.forwardRef<HTMLDivElement, GlassSkeletonProps>(15 ({ className, variant = "default", width, height, lines = 1, ...props }, ref) => {16 const baseClasses = cn(17 "relative overflow-hidden",18 "bg-white/5 backdrop-blur-sm",19 "before:absolute before:inset-0",20 "before:bg-gradient-to-r before:from-transparent before:via-white/10 before:to-transparent",21 "before:animate-[shimmer_2s_infinite]",22 )2324 const variantClasses = {25 default: "rounded-xl",26 circular: "rounded-full",27 text: "rounded-md h-4",28 card: "rounded-2xl min-h-[120px]",29 }3031 if (variant === "text" && lines > 1) {32 return (33 <div className="space-y-2" ref={ref} {...props}>34 {Array.from({ length: lines }).map((_, index) => (35 <motion.div36 key={index}37 className={cn(baseClasses, variantClasses.text, index === lines - 1 && "w-3/4", className)}38 style={{39 width: index === lines - 1 ? "75%" : width,40 height,41 backgroundSize: "400% 100%",42 }}43 animate={{44 backgroundPosition: ["200% 0", "-200% 0"],45 }}46 transition={{47 duration: 2,48 repeat: Number.POSITIVE_INFINITY,49 ease: "linear",50 delay: index * 0.1,51 }}52 aria-hidden="true"53 />54 ))}55 </div>56 )57 }5859 return (60 <motion.div61 ref={ref}62 className={cn(baseClasses, variantClasses[variant], className)}63 // Ensure onDrag prop is not forwarded to motion.div64 {...(() => {65 const { onDrag, ...rest } = props as any // eslint-disable-line @typescript-eslint/no-explicit-any66 return rest67 })()}68 style={{69 width,70 height,71 backgroundSize: "400% 100%",72 }}73 animate={{74 backgroundPosition: ["200% 0", "-200% 0"],75 }}76 transition={{77 duration: 2,78 repeat: Number.POSITIVE_INFINITY,79 ease: "linear",80 }}81// … truncated
What it pulls in
npm packages
Files it writes
More from einui
All 42 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Base Widgetbase-widget | einui | Components | Free | 1 dep | |
| Calendar Widgetscalendar-widget | einui | Components | Free | 1 dep | |
| Clock Widgetsclock-widget | einui | Components | Free | 1 dep | |
| Glass Alert Dialogglass-alert-dialog | einui | Components | Free | 1 dep | |
| Glass Avatarglass-avatar | einui | Components | Free | 1 dep | |
| Glass Badgeglass-badge | einui | Components | Free | 1 dep | |
| Glass Breadcrumbglass-breadcrumb | einui | Components | Free | 1 dep | |
| Glass Buttonglass-button | einui | Components | Free | 2 deps |
