Skeleton
Loading placeholders and structure hints
Usage
Skeleton
Text and avatar placeholders
Loading demo...
Card Placeholder
Skeletons inside cards for feeds.
Loading demo...
Best Practices
- Match skeleton width, height, line count, and radius to the final content so loading does not create a second layout.
- Use
TxSkeletonfor configurable text, rectangle, and avatar placeholders; useTxCardSkeletonorTxListItemSkeletonwhen their fixed structure matches the final surface. - Keep
loading=falseas the handoff point to real content instead of rendering skeleton and content in separate branches. - Do not use skeletons as decorative gray chrome. If the final content is unknown, prefer a neutral empty or loading state with copy.
- For a table, use
TxDataTablewithloadingVariant="skeleton": it draws placeholder rows shaped like its columns on the first load and keeps the rows during a refresh. Its defaultloadingoverlay suits a short local wait.
API Reference
Props
| Property | Type | Default | Description |
|---|---|---|---|
| loading | Whether to show the skeleton. `false` renders the default slot instead. | ||
| lines | Number of placeholder items; clamped to at least 1. | ||
| variant | Shape variant for each generated placeholder item. | ||
| width | Width; numbers are converted to px | ||
| height | Height; numbers are converted to px | ||
| radius | Corner radius for non-circle items; numbers are converted to px. | ||
| gap | Gap between multiple lines; numbers are converted to px |
Events
TxSkeleton, TxCardSkeleton, and TxListItemSkeleton do not emit custom events.
Slots
| Component | Slot | Props | Description |
|---|---|---|---|
TxSkeleton | default | - | Final content rendered only when loading=false. |
TxCardSkeleton | - | - | Fixed card placeholder; no slots. |
TxListItemSkeleton | - | - | Fixed list-row placeholder; no slots. |
Preset Components
| Export | Purpose |
|---|---|
TxSkeleton / Skeleton | Configurable line, rectangle, or circle placeholder. |
TxCardSkeleton / CardSkeleton | Fixed card/feed placeholder with icon, title, badge, and description blocks. |
TxListItemSkeleton / ListItemSkeleton | Fixed list-row placeholder with icon, name, meta, and trailing badge blocks. |
Dashboard Data Operations
For table loading, TxDataTable's loadingVariant="skeleton" draws the placeholder rows itself, and a short local wait can keep its default overlay; side summaries beside the table use TxSkeleton to preserve layout rhythm.
Data operations panel
Skeleton placeholders and table loading cover the data-region wait state together.
Loading demo...
Overview
loading=falserenders the default slot instead of the skeleton.linesalways renders at least one item, preventing empty skeleton output.variant="circle"always uses a circular radius and ignoresradius.- The
TxSkeletonroot isaria-hidden="true", so the decorative shimmer is not announced. Let the host region own the loading announcement (for examplearia-busyor a polite live region), then hand off to real content atloading=false.
Technologies
- Reviewed against
packages/tuffex/packages/components/src/skeleton/src/types.ts,TxSkeleton.vue,TxCardSkeleton.vue,TxListItemSkeleton.vue, andskeleton.test.ts. - Existing tests cover CSS-variable emission, numeric-to-px conversion, line count clamping, circle radius normalization, the decorative
aria-hiddenroot,loading=falseslot handoff, fixed preset rendering, and install registration. - API note:
TxSkeletonis the configurable primitive;TxCardSkeletonandTxListItemSkeletonare fixed-shape presets with no props, events, or slots. - Rendering note:
variant="circle"forces--tx-skeleton-radius: 999px; callers should set matchingwidthandheightfor a true circle. - Component source:
packages/tuffex/packages/components/src/skeleton/src/TxSkeleton.vue,TxCardSkeleton.vue, andTxListItemSkeleton.vue. - Types:
packages/tuffex/packages/components/src/skeleton/src/types.tsexportsSkeletonPropsandSkeletonVariant. - Verified coverage:
packages/tuffex/packages/components/src/skeleton/__tests__/skeleton.test.tsverifies CSS variable output, numeric-to-px conversion, line clamping, circle radius, the decorativearia-hiddenroot,loading=falseslot handoff, preset rendering, and install registration.
查看源码
packages/tuffex/packages/components/src/skeleton/index.ts