Skeleton
Placeholder shapes that hold the layout while content loads.
Use skeletons where content will appear in a known layout, such as a card, a list or table rows, so the page doesn't jump when the data arrives. For a task with measurable progress, use progress instead.
Installation
Pro components install from the Aloxe registry with the shadcn CLI. Once per project, add the registry to components.json and put a registry token in the ALOXE_TOKEN environment variable. Registry has the details.
{
"registries": {
"@aloxe": {
"url": "https://<aloxe-site>/r/{name}.json",
"headers": { "Authorization": "Bearer ${ALOXE_TOKEN}" }
}
}
}Then add the component:
npx shadcn@latest add @aloxe/skeletonThe CLI copies the source into components/ui/aloxe/, so it never overwrites your own ui components. It also installs @aloxe/react, @aloxe/tokens and @base-ui/react.
Import the tokens once in your global stylesheet, after Tailwind, and add an @source for the copied files and one for @aloxe/react, so Tailwind generates their classes. @source paths are relative to the stylesheet; these assume src/app/globals.css and src/components/ui/aloxe/.
@import "tailwindcss";
@import "@aloxe/tokens/aloxe.css";
@import "@aloxe/tokens/tailwind.css";
@source "../components/ui/aloxe";
@source "../../node_modules/@aloxe/react/dist";Installation covers the theme and brand attributes.
Usage
import { Suspense } from "react";
import { SkeletonCard } from "@/components/ui/aloxe/skeleton";
<Suspense fallback={<SkeletonCard label="Loading comment" />}>
<Comment id={id} />
</Suspense>SkeletonCard has the border, radius and padding of an outlined Card, so it works as a Suspense fallback or a loading.tsx without a layout shift. For any other layout, compose Skeleton shapes and size them with classes to match the content.
Examples
Shapes
text is one line, circle an avatar, block an image or a chart. Size each with classes such as w-2/3, size-8 or h-40.
Composed list
Build the loading state of your own layout from shapes, row for row. Wrap the whole region in one role="status" with a visually hidden label, rather than labelling each shape.
Accessibility
| Key | Action |
|---|---|
| None | Skeletons aren't focusable. Focus stays where it was until the content arrives. |
- Every
Skeletonisaria-hidden. Announce loading once per region:SkeletonCardis astatuswith a hidden label ("Loading" by default), and a composed region needs its ownrole="status". - Put
aria-busyon a table or list while its rows are placeholders. - The pulse is slow and stops with
prefers-reduced-motion.
API reference
Every part accepts className and renders a data-aloxe attribute you can target in CSS, such as [data-aloxe="skeleton"].
Skeleton
Extends <span aria-hidden>.
| Prop | Type | Default | Description |
|---|---|---|---|
| shape | "text" | "circle" | "block" | "text" | text is one 16 px line, circle a 40 px round, block a 96 px tall area. |
| className | string | Sizes the placeholder to match what loads, such as w-1/2, size-8 or h-40. |
SkeletonCard
Extends <div role="status">.
| Prop | Type | Default | Description |
|---|---|---|---|
| avatar | boolean | true | Shows a circle and two short lines at the top, like a card header with an avatar. |
| lines | number | 3 | Number of body text lines. The last one is shorter. |
| label | ReactNode | "Loading" | Announced to screen readers while the card is shown. |
| className | string | Merged with the default classes. |
Figma
Matches the Skeleton and Skeleton card components in the Pro Figma file. Skeleton Shape (Text, Circle, Block) maps to shape.
See Figma for where to get the file and how its names map to code.
Pro
Skeleton is part of Aloxe Pro. The previews on this page are open to everyone; the Code tab shows the example source once you sign in with a Pro license. See Access and licenses and Pricing.