skeleton
lyse/skeletonFreeComponent
lyse publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by lyse on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.getlyse.com/r/skeleton.jsonSource
1import * as React from "react"2import { cva, type VariantProps } from "class-variance-authority"34import { cn } from "@/lib/utils"5import "./skeleton.css"67const skeletonVariants = cva("skeleton-base", {8 variants: {9 shape: {10 text: "w-full rounded-[var(--layout-radius-sm)]",11 circle: "rounded-full aspect-square",12 rect: "w-full rounded-[var(--layout-radius-md)]",13 },14 size: {15 sm: "",16 md: "",17 lg: "",18 },19 animated: {20 true: "skeleton-shimmer",21 false: "",22 },23 },24 compoundVariants: [25 // text × size26 { shape: "text", size: "sm", class: "h-[var(--layout-size-2xs)]" },27 { shape: "text", size: "md", class: "h-[var(--layout-size-xs)]" },28 { shape: "text", size: "lg", class: "h-[var(--layout-size-base)]" },29 // circle × size30 { shape: "circle", size: "sm", class: "size-[var(--layout-size-sm)]" },31 { shape: "circle", size: "md", class: "size-[var(--layout-size-lg)]" },32 { shape: "circle", size: "lg", class: "size-[var(--layout-size-xl)]" },33 // rect × size34 { shape: "rect", size: "sm", class: "h-[var(--layout-size-sm)]" },35 { shape: "rect", size: "md", class: "h-[var(--layout-size-lg)]" },36 { shape: "rect", size: "lg", class: "h-[var(--layout-size-xl)]" },37 ],38 defaultVariants: {39 shape: "rect",40 size: "md",41 animated: true,42 },43})4445function Skeleton({46 className,47 shape,48 size,49 animated,50 ...props51}: React.ComponentProps<"div"> &52 VariantProps<typeof skeletonVariants>) {53 return (54 <div55 data-slot="skeleton"56 aria-hidden="true"57 className={cn(skeletonVariants({ shape, size, animated, className }))}58 {...props}59 />60 )61}6263export { Skeleton, skeletonVariants }
What it pulls in
npm packages
Other registry items
Files it writes
More from lyse
All 33 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| action-cardaction-card | lyse | Components | Free | no deps · 2 files | |
| alertalert | lyse | Components | Free | 2 deps · 2 files | |
| alert-dialogalert-dialog | lyse | Components | Free | 2 deps · 2 files | |
| avataravatar | lyse | Components | Free | 3 deps · 2 files | |
| badgebadge | lyse | Components | Free | 1 dep · 2 files | |
| banner-infobanner-info | lyse | Components | Free | 2 deps · 2 files | |
| breadcrumbbreadcrumb | lyse | Components | Free | 2 deps · 2 files | |
| buttonbutton | lyse | Components | Free | 2 deps · 2 files |
