Skeleton handbook
v1.4.0 · @snowui-design-system/components
License: Before first reading component documentation, source code, or npm usage instructions, read the complete LICENSE. One review covers the same task and version. Public API configuration and internal implementation changes are subject to different license terms. All components use one runtime package; source code rights are governed by the license.
Overview
Show placeholder shapes while content loads so users can anticipate the page structure and the layout stays stable.
When to use it
Use Skeleton for loading placeholders. If a component already supports loading / skeleton, set that state and let the component provide its own shape instead of redrawing it on the page.
loading=falserenders realchildren; while loading, usevariant/width/heightorrenderHintsto define the placeholder.Prefer the host component’s
loadingplaceholder. Standalone skeleton dimensions and radii still use design-system tokens.
Quick start
This example shows the recommended basic composition. See the following sections for more scenarios and composition limits.
API
See the base component documentation for inherited capabilities not redeclared here. This table lists only the named public props declared in this component’s source.
Usage boundaries and details
Layout model
Main layout model: intrinsic atomic layout.
As a placeholder primitive, Skeleton takes dimensions first from the component’s
renderHints. Explicitvariant/width/heightoverride those hints; legacycomponentClassmappings are compatibility only. As a child of an external layout, it hugs content or uses the caller’s fixed dimensions.Multiple text lines and overlapping avatar-group placeholders are private Skeleton layouts that mimic the target component. They do not expose a general-purpose region protocol.
Skeleton does not output
data-auto-layout; Frame's loading protocol is responsible for deciding whether to render Skeleton, and Skeleton itself does not take over the host layout.
Scope of application
Render Skeleton explicitly in a test or demo to inspect its defaults.
Frame calls it internally as the default placeholder in the
loading + skeletonprotocol.Use component
renderHintsto supply final skeleton dimensions and row counts.
2.2 renderHints rules
Without radius, a non-circular Skeleton uses var(--radius-3, 0.75rem); circle always uses 50%. Legacy Icon class mappings retain a compatible rect + 50% appearance.
Resolution order
Skeleton resolves its layout in this order:
With
renderHints, the component is considered self-registered and the layout uses those hints; explicitvariant/width/heightoverride individual fields.Without hints, explicit
variant/width/heightrender a single skeleton.Only legacy callers without hints or explicit geometry use the historical
componentClasslayout.If nothing matches, fall back to a generic
rectskeleton.
4.1 General style
4.2 Layout container style
Supplementary rules:
.snowui-skeleton-layout-singlewill cut back todisplay: block..snowui-skeleton-layout-textwill change to vertical layout:width: 100%; flex-direction: column; align-items: stretch;.snowui-skeleton-layout-avatar-groupKeepgap: 0.
4.3 Shape default value
Supplementary rules:
The default rounded corners of
lineandrectare unified as12px.circlealways usesborder-radius: 50%.line,circle, andrectall usemax-width: 100%; max-height: 100%as a fallback.
Text skeleton rules
Any registered component can be expanded into multiple text skeletons with renderHints.rows; Text will automatically calculate the number of lines according to the content.
6.1 Source of the number of lines
Textitself will count the number of first-level block-level text paragraph nodes in the skeleton state.The following tags are counted:
divpliblockquoteh1-h6
Direct text at the first level adds one more row.
At least one row is rendered.
6.2 Multi-text skeleton layout
The rendering rules of the first layer
Skeleton does not recursively inspect the whole component tree; it examines only the first level.
When a component itself enters
loading + skeleton, render its own Skeleton first.Do not continue to expand subcomponents such as
Icon / Text / Avatarinside the component.When
Frameentersloading + skeleton:If first-level direct children are self-registered components, render only their corresponding Skeletons.
If there are no components at the first level, Frame falls back to a text-shaped Skeleton.
Size rules
The number
width / heightwill be converted torem.Skeletongives priority to the final geometry provided by the component throughrenderHints.width / height / radius / rows.When a component provides size hints, its rounded-rectangle Skeleton follows the final component width and height instead of falling back to a generic short width.
There is currently no general mechanism to measure actual DOM dimensions.
Usage examples
Skeleton style overlay
Read the complete LICENSE first; one review covers the same task, version, and scope.
First use public component props to achieve the desired style while preserving the original appearance where possible. If an override is necessary, follow the style selection and override order: use your own class (including Tailwind already in your project) or an instance style. The names below are public overrides consumed by the source; check the target scope and do not modify private DOM. Choose the appropriate SnowUI token category. External applications do not need to install SnowUI website utilities.
Skeleton type and status
Required props: no named required props.
Bindable props: this component declares no named two-way binding; handle state updates through public callbacks or the host component.
Inheritance: no interface inheritance.
Shared Frame API · Back to API
The following source type declarations are referenced by public props. Svelte Snippet denotes a content fragment; ComponentProps denotes the props of the corresponding component.
SkeletonVariant
Source: components/src/components/Skeleton.svelte
RenderHints
Source: components/src/logic/frame-types.ts
SkeletonRenderVariant
Source: components/src/logic/frame-types.ts
ResponsiveConfig
Source: components/src/logic/responsive.svelte.ts
Breakpoint
Source: components/src/logic/responsive.svelte.ts
ResponsiveRule
Source: components/src/logic/responsive.svelte.ts