Feedback & Status
Skeleton
A placeholder that mimics the shape of content while it loads. Supports text lines, circles (avatars), and rectangles (images/cards) with shimmer, pulse, or wave animations. When loading becomes false the skeleton fades out smoothly.
Preview
Section titled “Preview”<nana-skeleton style="width: 220px; height: 1rem"></nana-skeleton> <script lang="ts">
import { NanaSkeleton } from '$lib/components/ui/skeleton';
</script>
<div class="flex w-full max-w-sm items-start gap-4">
<NanaSkeleton shape="circle" class="w-auto" />
<NanaSkeleton count={3} />
</div> Installation
Section titled “Installation”Install the package for a versioned dependency:
npm install @nana-tec/ui-componentsOr copy the source in and own it:
npx @nana-tec/ui add skeleton --framework web-componentsnpx @nana-tec/ui add skeleton --framework svelteLands in src/lib/components/ui/skeleton/ as NanaSkeleton.svelte, styled with Tailwind
classes that resolve to the design tokens. Requires Tailwind v4.
Import
Section titled “Import”
Import the autoloader once, in your app's entry point. Every <nana-*> tag then works anywhere, and
each component downloads only the first time a page uses it:
import "@nana-tec/ui-components/autoloader";import "@nana-tec/ui-components/theme";The second line gives every component the Nana look and the design tokens behind it. Leave it out to style the components entirely yourself.
Import a component directly when it must be ready at once: on screen at first paint, or when you call its methods straight away. The two mix freely:
import "@nana-tec/ui-components/skeleton";
Copied in with npx @nana-tec/ui add skeleton? Import your project's own
@/lib/nana-ui/autoloader.js once instead; the CLI keeps it up to date.
<script lang="ts"> import { NanaSkeleton } from '$lib/components/ui/skeleton';
let { invoice } = $props();</script>
<NanaSkeleton count={3} loading={!invoice}> <p>{invoice.description}</p></NanaSkeleton>While loading is true it draws placeholder lines, the last one shorter,
and marks itself busy; then it renders its children instead. shape is text,
circle or rect.
Basic usage
Section titled “Basic usage”<nana-skeleton style="width:220px;height:1rem"></nana-skeleton>Animations
Section titled “Animations”<nana-skeleton
animation="shimmer"
style="width: 220px; height: 1rem"
></nana-skeleton>
<nana-skeleton
animation="pulse"
style="width: 220px; height: 1rem"
></nana-skeleton>
<nana-skeleton
animation="wave"
style="width: 220px; height: 1rem"
></nana-skeleton>
<nana-skeleton
animation="none"
style="width: 220px; height: 1rem"
></nana-skeleton> Multiple lines
Section titled “Multiple lines”Use count to render several placeholder lines.
<nana-skeleton count="3" style="width: 100%"></nana-skeleton> Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
animation | animation | SkeletonAnimation | 'shimmer' | Animation style — shimmer, pulse, wave, or none |
count | count | number | 1 | Number of skeleton items to render |
loading | loading | boolean | true | When false the skeleton fades out and slotted content is visible |
shape | shape | SkeletonShape | 'text' | Shape of the skeleton placeholder |
size | size | SkeletonSize | 'md' | Relative size |
Slots
| Slot | Description |
|---|---|
(default) | Optional content revealed when loading completes |
CSS parts
| Part | Description |
|---|---|
::part(base) | Each skeleton item |
::part(wrapper) | The container wrapping all items (when count > 1) |
::part(root) | The skeleton and its content |
::part(shapes) | The placeholder shapes together |
::part(content) | The real content once loaded |
CSS custom properties
| Property | Description |
|---|---|
--nana-skeleton-radius | Corner radius override |
--nana-skeleton-height | Height override |
--nana-skeleton-width | Width override |
--nana-skeleton-gap | Gap between items when count > 1 |
--nana-skeleton-fade-duration | Fade-out transition duration (default 200ms) |
NanaSkeleton
| Prop | Type | Default |
|---|---|---|
shape | SkeletonShape | 'text' |
size | SkeletonSize | 'md' |
animation | SkeletonAnimation | 'pulse' |
count | number | 1 |
loading | boolean | true |
children | Snippet |
Also accepts Omit<HTMLAttributes<HTMLDivElement>, 'class'>.