骨架屏

呼吸脉冲占位块;skeleton--circle 为圆形。

<div style="display:flex;align-items:center;gap:12px">  <div class="skeleton skeleton--circle" style="width:40px;height:40px"></div>  <div style="flex:1;display:flex;flex-direction:column;gap:8px">    <div class="skeleton" style="height:12px;width:45%"></div>    <div class="skeleton" style="height:12px;width:80%"></div>  </div></div><div class="skeleton" style="height:12px;width:100%;margin-top:12px"></div><div class="skeleton" style="height:12px;width:66%;margin-top:8px"></div>

安装

bun add @icen.ai/ui

一行引入该组件(CSS 与 behavior 自动带上,无需关心内部 CSS 文件名):

import '@icen.ai/ui/kit/skeleton';

也可以用脚手架直接打印引入行:

bunx --bun @icen.ai/ui add skeleton

Astro 项目注意:kit 入口里的 CSS import 在页面 <script> 里会被 Astro 的 client bundle 摇掉——请改在布局 frontmatter 里引 CSS(import '@icen.ai/ui/components/feedback.css';),JS 行为仍可走 kit。Vite SPA / webpack 项目无此问题。

用法

<div class="skeleton" style="height:12px;width:80%"></div><div class="skeleton skeleton--circle" style="width:40px;height:40px"></div>