Skip to content

Skeleton

Provide placeholder graphics at locations where content is loading.

Basic Usage

The most basic text-only skeleton screen.

Basic Usage

Common Layouts

Quickly build common list item layouts with avatar, title, and rows.

Common Layouts

Fine-grained Item Control (SkeletonItem)

When built-in layouts don't meet your needs, use YhSkeletonItem for free composition. Supports semantic variants like circle, rect, text, button, image, and more.

Item Control Demo

Creative: Advanced Cards

Easily implement complex card flow skeletons using variant="rect" and repeat attributes.

Card Skeleton

Custom Advanced Features

1. Smart Throttling (Throttle)

Set display delay with throttle prop. If async data loads within the set time, the skeleton will never appear.

2. Viewport Detection (Lazy Animation)

When lazy is enabled, the skeleton animation only starts when the element enters the viewport.

3. Polymorphic Rendering

YhSkeletonItem covers common atomic placeholder variants for custom composition.

Use in Nuxt

YhSkeleton and YhSkeletonItem can be rendered directly in Nuxt after registering the YH-UI module. Skeleton placeholders render as normal markup during SSR, and animation continues on the client after hydration.

Use in Nuxt

API

Props

NameDescriptionTypeDefault
loadingWhether to show loading renderbooleantrue
animatedWhether to enable shimmer animationbooleantrue
rowsNumber of rows for the default layoutnumber3
titleWhether to render a title placeholderbooleanfalse
avatarWhether to render an avatar placeholderbooleanfalse
throttleDelay in milliseconds to prevent flickeringnumber0
lazyOnly start animation when in viewportbooleanfalse
theme-overridesComponent-level theme overridesComponentThemeVarsundefined

Events

This component does not expose component events.

Slots

NameParametersDescription
template-Skeleton placeholder content shown while loading is true.
default-Content rendered after loading completes.

Expose

This component does not expose public instance methods or properties.

Skeleton Item Props

NameDescriptionTypeDefault
variantVariant type (circle, rect, h1, h3, text, caption, button, image)YhSkeletonItemVariant'text'
widthWidthstring | numberundefined
heightHeightstring | numberundefined
animatedWhether to enable shimmer animationbooleantrue
roundWhether to use rounded cornersbooleanfalse
sharpWhether to force sharp cornersbooleanfalse
repeatNumber of times to repeatnumber1
theme-overridesComponent-level theme overridesComponentThemeVarsundefined

Skeleton Item Slots

NameParametersDescription
image-Custom placeholder content used when variant="image".

Skeleton Item Expose

This component does not expose public instance methods or properties.

Theme Variables

YhSkeleton and YhSkeletonItem support themeOverrides, but they do not define dedicated component-level CSS variables. Their styles mainly consume shared global tokens such as --yh-fill-color-dark, --yh-fill-color-light, --yh-radius-base, and --yh-text-color-placeholder.

Type Exports

NameDescription
YhSkeletonPropsSkeleton props type
YhSkeletonSlotsSkeleton slots type
YhSkeletonInstanceSkeleton instance type
YhSkeletonItemPropsSkeletonItem props type
YhSkeletonItemVariantSkeletonItem variant union type
YhSkeletonItemInstanceSkeletonItem instance type

Released under the MIT License.