Skip to content

GkSkeletonLoader

A placeholder surface modeled after Vuetify’s VSkeletonLoader: type selects a preset graph of “bones” (text bars, avatars, image blocks, …), rendered recursively with a shimmer overlay. When there is no default slot, the skeleton shows; when there is a default slot, the skeleton shows only while loading is true.

Use boilerplate for static placeholders (no role="alert" / live region). Otherwise the loading root exposes aria-live="polite", role="alert", and aria-label from loadingText.

There is no theme / locale composable layer — loadingText is a plain string (defaults to Loading).

When to use

Use as a visual placeholder while async content is loading, especially in cards, feed items, and table-heavy surfaces.

Live Examples

Card preset

Skeleton-only mode with type card and loading true.

Swap with content

When a default slot exists, loading toggles between bones and real markup.

Boilerplate list row

boilerplate disables live-region semantics for decorative placeholders.

API

Props

PropTypeDefaultDescription
loadingbooleanfalseWhen a default slot exists, show skeleton while true
typeGkSkeletonLoaderType, string, or array'ossein'Preset key(s); arrays are joined with commas (e.g. ['heading','paragraph'])
boilerplatebooleanfalseDecorative only — disables shimmer and alert semantics
loadingTextstring'Loading'aria-label when not boilerplate
colorstringSets --gk-skeleton-loader-wave for the shimmer highlight
width / height / maxWidth / maxHeightnumber | stringApplied to the root
elevation05Shadow preset on the root

Additional attributes are forwarded to the skeleton root (not to bones).

Slots

SlotDescription
defaultReal content; shown when loading is false (or omitted with no loading when the slot is present)

Presets

Keys are listed on gkSkeletonRootTypes (exported from god-kit/vue). Examples: card, article, table, list-item-avatar, date-picker, paragraph, ossein.

Utilities

ExportDescription
genGkSkeletonStructure(type)Returns a GkSkeletonNode[] tree for tests or custom renderers
wrapGkSkeletonTypes(type)Normalizes type to a comma-separated string
isGkSkeletonLoaderType(value)Type guard for preset keys

Tokens

TokenPurpose
--gk-skeleton-loader-trackBone base fill
--gk-skeleton-loader-waveShimmer highlight
--gk-skeleton-loader-shimmer-durationAnimation length
--gk-skeleton-loader-*-height / -sizeBone dimensions

Examples

Each scenario under Live Examples includes a copyable Vue snippet (source is imported from the same SFC as the preview).

Accessibility notes

  • Use boilerplate for decorative placeholders that should not announce loading state.
  • Keep loadingText specific when skeletons represent long-running async operations.

Released under the MIT License.