Skip to content

Skeleton

Neo-brutalist skeleton loading component providing sub-components for common loading patterns.

Demo

Preview

变体

头像尺寸

sm
default
lg
xl

骨架文本

骨架卡片

骨架表格

基础尺寸

形状

自定义宽度

Installation

pnpm dlx brutx-vue@latest add skeleton

Usage

Basic Skeleton

vue
<script setup>
import { Skeleton } from 'brutx-ui-vue'
</script>

<template>
    <Skeleton class="h-12 w-12" />
</template>

Shapes

ShapeDescription
rectRounded rectangle (rounded-brutal)
circleCircle (rounded-full) with equal width and height
vue
<template>
    <div class="flex items-center gap-4">
        <Skeleton shape="rect" size="lg" width="80px" />
        <Skeleton shape="circle" size="lg" />
    </div>
</template>

Custom Width

width accepts any CSS width string, including percentages. When shape="circle", it also sets the height.

vue
<template>
    <div class="space-y-2 w-full">
        <Skeleton width="100%" />
        <Skeleton width="75%" />
        <Skeleton width="50%" />
    </div>
</template>

SkeletonText

vue
<script setup>
import { SkeletonText } from 'brutx-ui-vue'
</script>

<template>
    <SkeletonText :lines="3" />
</template>

SkeletonAvatar

vue
<script setup>
import { SkeletonAvatar } from 'brutx-ui-vue'
</script>

<template>
    <SkeletonAvatar size="default" />
</template>

SkeletonCard

vue
<script setup>
import { SkeletonCard } from 'brutx-ui-vue'
</script>

<template>
    <SkeletonCard />
</template>

SkeletonTable

vue
<script setup>
import { SkeletonTable } from 'brutx-ui-vue'
</script>

<template>
    <SkeletonTable :rows="5" :columns="4" />
</template>

Variants

VariantDescription
defaultGray background
primaryPrimary color at 30% opacity
secondarySecondary color at 30% opacity
accentAccent color at 30% opacity

Sizes

SizeHeight
smh-8
defaulth-10
lgh-14
xlh-20

When shape="circle", width matches height (w-8/w-10/w-14/w-20).

vue
<template>
    <div class="space-y-2">
        <Skeleton size="sm" width="200px" />
        <Skeleton size="default" width="200px" />
        <Skeleton size="lg" width="200px" />
        <Skeleton size="xl" width="200px" />
    </div>
</template>

Sub-components

ComponentDescription
SkeletonBasic skeleton block with built-in role="status" and aria-busy="true" accessibility attributes
SkeletonTextMulti-line skeleton text with customizable line count and last line width
SkeletonAvatarCircular avatar placeholder
SkeletonCardComplete card skeleton with image area, title, text, and button placeholders
SkeletonTableTable skeleton with built-in role="table" and aria-busy="true" accessibility attributes

Props

Skeleton

PropTypeDefaultDescription
variant'default' | 'primary' | 'secondary' | 'accent''default'Color variant
size'sm' | 'default' | 'lg' | 'xl''default'Controls height (also controls width for circle)
shape'rect' | 'circle''rect'Shape; circle uses rounded-full with equal width and height
widthstringCustom width, supports percentages like '100%'; also sets height for circle
classstringCustom style class

SkeletonText

PropTypeDefaultDescription
variant'default' | 'primary' | 'secondary' | 'accent''default'Color variant
linesnumber3Number of text lines
lastLineWidthstring'60%'Width of the last line, supports any CSS width value
classstringCustom style class

SkeletonAvatar

PropTypeDefaultDescription
variant'default' | 'primary' | 'secondary' | 'accent''default'Color variant
size'sm' | 'default' | 'lg' | 'xl''default'Avatar size with equal width and height
classstringCustom style class

SkeletonCard

PropTypeDefaultDescription
variant'default' | 'primary' | 'secondary' | 'accent''default'Color variant
classstringCustom style class

SkeletonTable

PropTypeDefaultDescription
variant'default' | 'primary' | 'secondary' | 'accent''default'Color variant
rowsnumber5Number of data rows
columnsnumber4Number of columns
classstringCustom style class

Slots

SlotScopeDescription
defaultContent inside the skeleton block, can hold custom loading indicators or other elements

Accessibility

  • ARIA Attributes: Skeleton has built-in role="status" and aria-busy="true"; SkeletonTable has built-in role="table" and aria-busy="true"

Brute force builds.