文档菜单

文本骨架屏

可组合的文本占位符,末行宽度自然。

安装

pnpm dlx shadcn@latest add https://loading.design/r/text-skeleton.json

用法

import { TextSkeleton } from "@/components/loading/text-skeleton"
<TextSkeleton lines={4} lastLineWidth="68%" animated={true} />

API

属性类型默认值说明
linesnumber3占位文本的行数。
lastLineWidth`${number}%`68%最后一行的宽度,用于模拟自然段落末行。
animatedbooleantrue是否应用轻微的透明度脉冲。

无障碍

骨架占位内容对辅助技术隐藏。请为它代表的区域设置 aria-busy,并保持该区域的无障碍名称稳定。