Components/Skeleton

Skeleton

Placeholder shapes that hold the layout until content loads.

VerifiedSince 0.3.4

Usage

Text and Avatar

lines sets the line count; variant="circle" with equal width and height draws a true circle.

Loading demo...

Card Placeholder

Loading demo...

Dashboard Data Operations

Side summaries beside the table keep their structure with TxSkeleton and TxLayoutSkeleton.

Loading demo...

Best Practices

  • Match width, height, line count, and radius to the final content so loading doesn't create a second layout.
  • Use TxCardSkeleton or TxListItemSkeleton only when their fixed structure matches the final UI.
  • Hand off to real content with loading=false rather than keeping skeleton and content in separate branches.
  • If the final structure is unknown, use an empty or loading state with copy instead.
  • For tables, use TxDataTable with loadingVariant="skeleton" instead of composing skeleton rows.

API Reference

Props

PropertyTypeDefaultDescription
loadingShows the skeleton; `false` renders the default slot.
linesNumber of placeholder items; at least 1.
variantShape of each placeholder item.
widthWidth; numbers are px.
heightHeight; numbers are px.
radiusCorner radius of non-circle items; numbers are px.
gapGap between lines; numbers are px.

Slots

ComponentSlotPropsDescription
TxSkeletondefault-Real content, rendered when loading=false.
TxCardSkeleton--Fixed card placeholder; no slots.
TxListItemSkeleton--Fixed list-row placeholder; no slots.

Preset Components

ExportPurpose
TxSkeleton / SkeletonConfigurable text, rectangle, or circle placeholder.
TxCardSkeleton / CardSkeletonCard or feed placeholder: icon, title, badge, and description.
TxListItemSkeleton / ListItemSkeletonList-row placeholder: icon, name, meta, and trailing badge.
TxRowSkeleton / RowSkeletonSettings-row placeholder: optional icon, description, and trailing control.

TxRowSkeleton

Props

PropertyTypeDefaultDescription
rowsNumber of rows; at least 1.
leadingReserves space for a leading icon.
descriptionAdds a narrower description bar under the title.
trailingReserves space for a trailing control (switch, button, chip).
separatedDraws a hairline between rows on the same pixel as the real list separator.
titleWidthBase width of the title bar, varied slightly per row; numbers are px.
descWidthWidth of the description bar; numbers are px.

useDeferredLoading

Turns a raw loading flag into a skeleton flag that doesn't flicker.

ParameterTypeDefaultDescription
sourceMaybeRefOrGetter<boolean>-The raw loading flag.
options.delaynumber150Milliseconds before the skeleton shows; data that arrives sooner never shows one.
options.minDurationnumber400Minimum milliseconds the skeleton stays once shown.
ReturnsRef<boolean>-Whether to show the skeleton.

Overview

  • variant="circle" fixes the radius at 999px and ignores radius.
  • TxCardSkeleton and TxListItemSkeleton have fixed shapes and no props, events, or slots.
  • The root is aria-hidden="true"; the host region announces loading, for example with aria-busy or a polite live region.

Technologies

  • Source: packages/tuffex/packages/components/src/skeleton/.
查看源码
packages/tuffex/packages/components/src/skeleton/index.ts