加载指示器

New

加载指示器,内置十七种样式:旋转圈、圆点、条形、点阵、抖动噪点、变形、彗星、乱码扫描、融球、牛顿摆、螺旋、百分比,以及五款终端风格的 ASCII 动画。单一 size 属性即可缩放,使用 currentColor 取色,「减少动效」偏好下所有变换动效都会替换为平缓的透明度脉冲。

LoadingSpinner
LoadingDots
LoadingBars
LoadingDot Matrix
LoadingDither
LoadingLoadingMorph
LoadingComet
LoadingLoadingMetaballs
LoadingNewton
LoadingHelix
LOADINGLoadingScramble
0%LoadingPercent
LoadingASCII
|LoadingASCII Line
LoadingASCII Braille
LoadingASCII Blocks
LoadingASCII Bounce

安装

用 shadcn CLI 添加,或手动复制源码。

$ bunx --bun shadcn add @uilab/loader

API 参考

variant?
"metaballs" | "dots" | "spinner" | "bars" | "dot-matrix" | "dither" | "ascii" | "ascii-line" | "ascii-braille" | "ascii-blocks" | "ascii-bounce" | "morph" | "comet" | "scramble" | "newton" | "helix" | "percent"

Which animation to render.

spinner
size?
number

Base square size in px. Everything scales from this.

32
speed?
number

Seconds per animation cycle.

1
label?
string

Accessible label announced to screen readers.

Loading
className?
string

Keep in mind

Some components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.