Skeleton

骨架屏:内容加载前的占位,文本 / 矩形 / 圆形三种形状,流光与呼吸两种动画,自动适配深浅色主题。

属性

属性类型默认值说明
shape'text' | 'rect' | 'circle''text'形状:text / rect / circle
widthnumber | string—宽度,数字按 px 处理
heightnumber | string—高度,数字按 px 处理
linesnumber1文本行数,仅 text 生效
animation'shimmer' | 'pulse' | 'none''shimmer'动画:shimmer / pulse / none
loadingbooleantrue为 false 时直接渲染 children
childrenReactNode—加载完成后的内容;加载中用于撑开尺寸
...restHTMLAttributes—其余属性透传给原生 div;骨架自带 aria-hidden,建议在外层容器设置 aria-busy