Skip to content

Spinner

Neo-brutalist loading spinner offering 4 visual variants: standard, block, dots, and bars.

Demo

Preview

加载器类型

加载中...
旋转
加载中...
方块
加载中...
条形
加载中...
圆点

加载器尺寸

加载中...
加载中...
默认
加载中...
加载中...
超大

加载器变体

加载中...
默认
加载中...
主要
加载中...
次要
加载中...
强调

Installation

pnpm dlx brutx-vue@latest add spinner

Usage

Spinner (Standard)

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

<template>
    <Spinner size="default" variant="default" />
</template>

BlockSpinner

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

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

DotsSpinner

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

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

BarsSpinner

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

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

Variants

Spinner Variants

VariantDescription
defaultTransparent top and right borders, spinning
primaryPrimary color border, spinning
secondarySecondary color border, spinning
accentTransparent top and right accent color borders, spinning

Color Schemes

BlockSpinner, BarsSpinner, and DotsSpinner support the following color schemes:

ColorDescription
defaultDefault foreground color
primaryPrimary color
secondarySecondary color
accentAccent color
mixedCycles through primary, secondary, accent, and info colors (BlockSpinner and BarsSpinner only)

Sizes

All spinner types support the following sizes:

SizeSpinnerBlockBarsDots
smh-5 w-5h-5 w-5h-4gap-1
defaulth-8 w-8h-8 w-8h-6gap-2
lgh-12 w-12h-12 w-12h-8gap-3
xlh-16 w-16h-16 w-16h-12gap-4

Animation

Each component uses different animation effects:

ComponentAnimation TypeDescription
Spinneranimate-spinSpinning animation
BlockSpinneranimate-pulsePulse animation with staggered delay across 4 blocks
BarsSpinneranimate-pulsePulse animation with staggered delay across 5 bars
DotsSpinneranimate-bounceBounce animation with staggered delay across 3 dots

Props

Spinner

PropTypeDefaultDescription
size'sm' | 'default' | 'lg' | 'xl''default'Size
variant'default' | 'primary' | 'secondary' | 'accent''default'Color variant
labelstringt('spinner.loading')Accessibility label text
classstringCustom style class

BlockSpinner / BarsSpinner

PropTypeDefaultDescription
size'sm' | 'default' | 'lg' | 'xl''default'Size
color'default' | 'primary' | 'secondary' | 'accent' | 'mixed''default'Color scheme; mixed cycles through multiple colors
labelstringt('spinner.loading')Accessibility label text
classstringCustom style class

DotsSpinner

PropTypeDefaultDescription
size'sm' | 'default' | 'lg' | 'xl''default'Size
color'default' | 'primary' | 'secondary' | 'accent''default'Color scheme
labelstringt('spinner.loading')Accessibility label text
classstringCustom style class

Accessibility

  • ARIA Attributes: All Spinner components automatically add the role="status" attribute
  • Screen Readers: Provides screen reader labels via aria-label, using the sr-only class to hide visual text
  • Custom Labels: The default label text is the localized "Loading..." and can be customized via the label prop

Brute force builds.