Skeleton Demo
sora-ui/demo-skeletonFreeComponent
A profile card loading, then crossfading into content once ready.
Install it
npx shadcn@latest add https://ui.soralabs.io.vn/r/demo-skeleton.jsonSource
1"use client";23import { useEffect, useState } from "react";4import {5 Skeleton,6 SkeletonAvatar,7 SkeletonText,8 SkeletonTransition,9} from "@/components/sora-ui/effects/skeleton";1011const LOADING_DURATION_MS = 2000;1213function ProfileCard() {14 return (15 <div className="flex items-center gap-3">16 <div className="flex size-10 items-center justify-center rounded-full bg-accent font-medium text-sm">17 AX18 </div>19 <div className="flex flex-col gap-1">20 <p className="font-medium text-sm">Axyl</p>21 <p className="text-muted-foreground text-xs">22 Building Sora UI, one primitive at a time.23 </p>24 </div>25 </div>26 );27}2829function ProfileSkeleton() {30 return (31 <div className="flex items-center gap-3">32 <SkeletonAvatar />33 <div className="flex flex-col gap-2">34 <SkeletonText className="w-24" />35 <SkeletonText className="w-40" />36 </div>37 </div>38 );39}4041export default function SkeletonDemo() {42 const [loading, setLoading] = useState(true);4344 useEffect(() => {45 const timer = window.setTimeout(46 () => setLoading(false),47 LOADING_DURATION_MS48 );49 return () => window.clearTimeout(timer);50 }, []);5152 const replay = () => {53 setLoading(true);54 window.setTimeout(() => setLoading(false), LOADING_DURATION_MS);55 };5657 return (58 <div className="flex w-full max-w-sm flex-col gap-4 rounded-xl border p-6">59 <Skeleton className="h-24 w-full" rounded="lg" variant="fade" />60 <SkeletonTransition loading={loading} skeleton={<ProfileSkeleton />}>61 <ProfileCard />62 </SkeletonTransition>63 <button64 className="self-start text-muted-foreground text-xs underline underline-offset-2 hover:text-foreground"65 onClick={replay}66 type="button"67 >68 Replay69 </button>70 </div>71 );72}
What it pulls in
Other registry items
Files it writes
More from Sora UI
All 97 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | Sora UI | Components | Free | 2 deps | |
| Border Trailborder-trail | Sora UI | Components | Free | 1 dep | |
| Bottom Sheetbottom-sheet | Sora UI | Components | Free | 2 deps | |
| Cursor Bubblecursor-bubble | Sora UI | Components | Free | 2 deps | |
| Cursor Trail Revealcursor-trail-reveal | Sora UI | Components | Free | 1 dep | |
| Custom Cursorcustom-cursor | Sora UI | Components | Free | 2 deps | |
| Accordion Demodemo-accordion | Sora UI | Components | Free | no deps | |
| Border Trail Demodemo-border-trail | Sora UI | Components | Free | no deps |
