feat: add CloseButton Avatar and Skeleton components
This commit is contained in:
@@ -44,10 +44,14 @@ const groups = [
|
||||
{
|
||||
title: "组件",
|
||||
items: [
|
||||
{ title: "Avatar 头像", url: "/components/avatar" },
|
||||
{ title: "AvatarGroup 头像组", url: "/components/avatar-group" },
|
||||
{ title: "Button 按钮", url: "/components/button" },
|
||||
{ title: "Card 卡片", url: "/components/card" },
|
||||
{ title: "CloseButton 关闭按钮", url: "/components/close-button" },
|
||||
{ title: "Input 输入框", url: "/components/input" },
|
||||
{ title: "Link 链接", url: "/components/link" },
|
||||
{ title: "Skeleton 骨架屏", url: "/components/skeleton" },
|
||||
{ title: "Spinner 加载指示器", url: "/components/spinner" },
|
||||
{ title: "Surface 表面", url: "/components/surface" },
|
||||
{ title: "Switch 开关", url: "/components/switch" },
|
||||
|
||||
@@ -13,3 +13,49 @@
|
||||
@slot;
|
||||
}
|
||||
}
|
||||
|
||||
/* Demo-only utilities ported from the baseline docs global.css. */
|
||||
@keyframes shine {
|
||||
0% {
|
||||
translate: -100% 0;
|
||||
}
|
||||
100% {
|
||||
translate: 100% 0;
|
||||
}
|
||||
}
|
||||
|
||||
@utility shadow-panel {
|
||||
box-shadow: var(--surface-shadow);
|
||||
}
|
||||
|
||||
@utility animate-shine {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(
|
||||
120deg,
|
||||
transparent 10%,
|
||||
rgba(255, 255, 255, 0.3) 45%,
|
||||
rgba(255, 255, 255, 0.1) 55%,
|
||||
transparent 90%
|
||||
);
|
||||
animation: shine 3s ease-in-out infinite;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&:where(.dark, .dark *, [data-theme="dark"], [data-theme="dark"] *)::after {
|
||||
background: linear-gradient(
|
||||
120deg,
|
||||
transparent 10%,
|
||||
rgba(255, 255, 255, 0.1) 45%,
|
||||
rgba(255, 255, 255, 0.04) 55%,
|
||||
transparent 90%
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,14 @@ title: 组件
|
||||
description: 已迁移组件及文档
|
||||
---
|
||||
|
||||
- [Avatar 头像](./components/avatar)
|
||||
- [AvatarGroup 头像组](./components/avatar-group)
|
||||
- [Button 按钮](./components/button)
|
||||
- [Card 卡片](./components/card)
|
||||
- [CloseButton 关闭按钮](./components/close-button)
|
||||
- [Input 输入框](./components/input)
|
||||
- [Link 链接](./components/link)
|
||||
- [Skeleton 骨架屏](./components/skeleton)
|
||||
- [Spinner 加载指示器](./components/spinner)
|
||||
- [Surface 表面](./components/surface)
|
||||
- [Switch 开关](./components/switch)
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
---
|
||||
title: AvatarGroup 头像组
|
||||
description: 以叠放或网格展示多个头像,并支持溢出计数
|
||||
component: avatar-group
|
||||
group: 组件
|
||||
---
|
||||
|
||||
## 用法
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
```
|
||||
|
||||
<ComponentPreview name="avatar-group-basic" />
|
||||
|
||||
## 组件结构
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarGroupCount,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AvatarGroup>
|
||||
<Avatar>
|
||||
<AvatarImage />
|
||||
<AvatarFallback />
|
||||
</Avatar>
|
||||
<AvatarGroupCount><!-- 可选的显式子组件 --></AvatarGroupCount>
|
||||
</AvatarGroup>
|
||||
</template>
|
||||
```
|
||||
|
||||
## 示例
|
||||
|
||||
### 最大数量
|
||||
|
||||
<ComponentPreview name="avatar-group-max" />
|
||||
|
||||
### 自定义计数
|
||||
|
||||
<ComponentPreview name="avatar-group-count" />
|
||||
|
||||
### 尺寸
|
||||
|
||||
<ComponentPreview name="avatar-group-sizes" />
|
||||
|
||||
### 网格
|
||||
|
||||
<ComponentPreview name="avatar-group-grid" />
|
||||
|
||||
### 叠放样式(Overlap)
|
||||
|
||||
<ComponentPreview name="avatar-group-overlap" />
|
||||
|
||||
## 自定义样式
|
||||
|
||||
### Tailwind CSS
|
||||
|
||||
<ComponentPreview name="avatar-group-custom-styles" />
|
||||
|
||||
### 全局 CSS
|
||||
|
||||
可使用 `@layer components` 指令自定义 AvatarGroup 组件类。
|
||||
|
||||
```css
|
||||
@layer components {
|
||||
.hv-avatar-group {
|
||||
--avatar-group-overlap: 0.75rem;
|
||||
--avatar-group-seam: 2px;
|
||||
}
|
||||
|
||||
.hv-avatar-group__count {
|
||||
@apply font-semibold;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 样式参考
|
||||
|
||||
HeroUI 遵循 [BEM](https://getbem.com/) 方法论,确保组件变体与状态可复用且易于自定义。
|
||||
|
||||
### CSS 类
|
||||
|
||||
AvatarGroup 组件使用以下 CSS 类:
|
||||
|
||||
#### 基础类 [!toc]
|
||||
|
||||
- `.hv-avatar-group` - 头像组基础容器
|
||||
- `.hv-avatar-group--grid` - 网格布局修饰符(无叠放)
|
||||
- `.hv-avatar-group--clip` - 新月裁切 / 透明缝(默认叠放)
|
||||
- `.hv-avatar-group--ring` - 通过 `--background` 的实线 box-shadow 描边
|
||||
- `.hv-avatar-group__count` - 溢出计数头像
|
||||
|
||||
叠放布局在兄弟元素之间使用负外边距(`--avatar-group-overlap`,默认 `0.5rem`)。clip 模式对非末子头像做遮罩,并光学微调 fallback 字形;ring 模式使用 `--background` 细线 box-shadow 描边。
|
||||
|
||||
## API 参考
|
||||
|
||||
### AvatarGroup
|
||||
|
||||
| Prop | 类型 | 默认值 | 描述 |
|
||||
| --------- | ------------------------------------------------------------- | -------- | -------------------------------------------------------------------------- |
|
||||
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | 当子 Avatar 未指定 `size` 时应用到子头像(及溢出计数);默认与 Avatar 一致 |
|
||||
| `color` | `'default' \| 'accent' \| 'success' \| 'warning' \| 'danger'` | - | 当子 Avatar 未指定 `color` 时,应用到子头像(及溢出计数)的颜色 |
|
||||
| `variant` | `'default' \| 'soft'` | - | 当子 Avatar 未指定 `variant` 时,应用到子头像(及溢出计数)的变体 |
|
||||
| `max` | `number` | - | 最多渲染的头像子项数量;省略则显示全部 |
|
||||
| `isGrid` | `boolean` | `false` | 是否使用无叠放的换行网格布局 |
|
||||
| `overlap` | `'clip' \| 'ring'` | `'clip'` | 叠放样式:新月裁切(默认)或 box-shadow 描边;`isGrid` 时忽略 |
|
||||
| `class` | `string` | - | 附加 CSS 类 |
|
||||
| 默认插槽 | `Avatar[] \| AvatarGroupCount` | - | 要组合的 Avatar 组件(以及可选的 `AvatarGroupCount`) |
|
||||
|
||||
### AvatarGroupCount
|
||||
|
||||
由 `Avatar` + `AvatarFallback` 组合而成,用于溢出指示。不受 `max` 截断。
|
||||
|
||||
| Prop | 类型 | 默认值 | 描述 |
|
||||
| --------- | ------------------------------------------------------------- | ------ | --------------------- |
|
||||
| 默认插槽 | `string \| Component` | - | 计数内容(例如 `+3`) |
|
||||
| `size` | `'sm' \| 'md' \| 'lg'` | - | 覆盖组的尺寸 |
|
||||
| `color` | `'default' \| 'accent' \| 'success' \| 'warning' \| 'danger'` | - | 覆盖组的颜色 |
|
||||
| `variant` | `'default' \| 'soft'` | - | 覆盖组的变体 |
|
||||
| `class` | `string` | - | 附加 CSS 类 |
|
||||
|
||||
## 注意事项
|
||||
|
||||
- AvatarGroup 通过 provide/inject 仅向**直接 Avatar 子组件**传递 `size`、`color` 与 `variant`
|
||||
- 设置 `max` 会截断可见头像并根据剩余子项自动计数;省略则显示全部
|
||||
- 已知总量(例如来自服务端)时,渲染显式的 `AvatarGroupCount` — 它不受 `max` 截断,并会抑制自动计数。请用 `Count` 替代已移除的 v2 `total`
|
||||
- `isGrid` 会禁用叠放,改为换行网格布局
|
||||
- `overlap` 默认为 `"clip"`(新月裁切);使用 `"ring"` 可改为实线描边;与 `isGrid` 同时使用时无效
|
||||
- 默认不加 `role="group"` — 当叠放有语义(指派人、在看的人)时,自行加上 `role="group"`,并配合 `aria-label` 或 `aria-labelledby`
|
||||
|
||||
## 相关组件
|
||||
|
||||
[Avatar 头像](./avatar) · [Card 卡片](./card)
|
||||
@@ -0,0 +1,149 @@
|
||||
---
|
||||
title: Avatar 头像
|
||||
description: 显示用户头像,支持自定义 fallback 内容
|
||||
component: avatar
|
||||
group: 组件
|
||||
---
|
||||
|
||||
## 用法
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
|
||||
</script>
|
||||
```
|
||||
|
||||
<ComponentPreview name="avatar-basic" />
|
||||
|
||||
## 组件结构
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Avatar>
|
||||
<AvatarImage />
|
||||
<AvatarFallback />
|
||||
</Avatar>
|
||||
</template>
|
||||
```
|
||||
|
||||
## 示例
|
||||
|
||||
### 尺寸
|
||||
|
||||
<ComponentPreview name="avatar-sizes" />
|
||||
|
||||
### 颜色
|
||||
|
||||
<ComponentPreview name="avatar-colors" />
|
||||
|
||||
### 变体
|
||||
|
||||
<ComponentPreview name="avatar-variants" />
|
||||
|
||||
### 回退内容
|
||||
|
||||
<ComponentPreview name="avatar-fallback" />
|
||||
|
||||
## 自定义样式
|
||||
|
||||
### 自定义图片组件
|
||||
|
||||
在 `AvatarImage` 上使用 `as-child`,即可与自定义图片组件组合。请将 `src` 传给 `AvatarImage`,以便跟踪加载状态,并在图片就绪前显示回退内容。
|
||||
|
||||
<ComponentPreview name="avatar-custom-image-component" />
|
||||
|
||||
### Tailwind CSS
|
||||
|
||||
<ComponentPreview name="avatar-custom-styles" />
|
||||
|
||||
### 全局 CSS
|
||||
|
||||
可使用 `@layer components` 指令自定义 Avatar 组件类。
|
||||
|
||||
```css
|
||||
@layer components {
|
||||
.hv-avatar {
|
||||
@apply size-16 border-2 border-accent;
|
||||
}
|
||||
|
||||
.hv-avatar__fallback {
|
||||
@apply bg-gradient-to-br from-purple-500 to-pink-500;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 样式参考
|
||||
|
||||
HeroUI 遵循 [BEM](https://getbem.com/) 方法论,确保组件变体与状态可复用且易于自定义。
|
||||
|
||||
### CSS 类
|
||||
|
||||
Avatar 组件使用以下 CSS 类:
|
||||
|
||||
#### 基础类 [!toc]
|
||||
|
||||
- `.hv-avatar` - 基础容器,默认尺寸(size-10)
|
||||
- `.hv-avatar__image` - 图片元素,aspect-square 尺寸
|
||||
- `.hv-avatar__fallback` - 居中内容的 fallback 容器
|
||||
|
||||
#### 尺寸修饰符 [!toc]
|
||||
|
||||
- `.hv-avatar--sm` - 小头像(size-8)
|
||||
- `.hv-avatar--md` - 中头像(默认,无额外样式)
|
||||
- `.hv-avatar--lg` - 大头像(size-12)
|
||||
|
||||
#### 变体修饰符 [!toc]
|
||||
|
||||
- `.hv-avatar--soft` - 浅色背景的 soft 变体
|
||||
|
||||
#### 颜色修饰符 [!toc]
|
||||
|
||||
- `.hv-avatar__fallback--default` - 默认文字颜色
|
||||
- `.hv-avatar__fallback--accent` - 强调色文字
|
||||
- `.hv-avatar__fallback--success` - 成功色文字
|
||||
- `.hv-avatar__fallback--warning` - 警告色文字
|
||||
- `.hv-avatar__fallback--danger` - 危险色文字
|
||||
|
||||
## API 参考
|
||||
|
||||
### Avatar
|
||||
|
||||
| Prop | 类型 | 默认值 | 描述 |
|
||||
| --------- | ------------------------------------------------------------- | ----------- | ----------------- |
|
||||
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | 头像尺寸 |
|
||||
| `color` | `'default' \| 'accent' \| 'success' \| 'warning' \| 'danger'` | `'default'` | Fallback 颜色主题 |
|
||||
| `variant` | `'default' \| 'soft'` | `'default'` | 视觉样式变体 |
|
||||
| `class` | `string` | - | 附加 CSS 类 |
|
||||
|
||||
### AvatarImage
|
||||
|
||||
| Prop | 类型 | 默认值 | 描述 |
|
||||
| ------------- | ---------------------------------- | ------- | ------------------------------------------ |
|
||||
| `src` | `string` | - | 图片 URL |
|
||||
| `srcSet` | `string` | - | 响应式图片的 `srcset` 属性 |
|
||||
| `sizes` | `string` | - | 响应式图片的 `sizes` 属性 |
|
||||
| `alt` | `string` | - | 图片替代文本 |
|
||||
| `asChild` | `boolean` | `false` | 将属性合并到子元素上,而不是渲染原生 `img` |
|
||||
| `@load` | `(event: Event) => void` | - | 图片加载成功时的回调 |
|
||||
| `@error` | `(event: Event) => void` | - | 图片加载失败时的回调 |
|
||||
| `crossOrigin` | `'anonymous' \| 'use-credentials'` | - | 图片请求的 CORS 设置 |
|
||||
| `loading` | `'eager' \| 'lazy'` | - | 原生懒加载属性 |
|
||||
| `class` | `string` | - | 附加 CSS 类 |
|
||||
|
||||
### AvatarFallback
|
||||
|
||||
| Prop | 类型 | 默认值 | 描述 |
|
||||
| --------- | ------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------- |
|
||||
| `delayMs` | `number` | - | 显示 fallback 前的延迟(防止闪烁)。`0` 与未指定不同:底座在 `delayMs=0` 时不会显示 fallback,需要延迟时请传正数 |
|
||||
| `color` | `'default' \| 'accent' \| 'success' \| 'warning' \| 'danger'` | - | 覆盖父级颜色(替换而非叠加) |
|
||||
| `class` | `string` | - | 附加 CSS 类 |
|
||||
|
||||
Avatar 使用 Reka UI 的 `AvatarRoot` / `AvatarImage` / `AvatarFallback` 处理加载与回退状态。`onLoad` / `onError` 对应 Vue 原生 `@load` / `@error` 事件,不声明与 React 合成事件完全等价。
|
||||
|
||||
## 相关组件
|
||||
|
||||
[AvatarGroup 头像组](./avatar-group) · [Card 卡片](./card)
|
||||
@@ -0,0 +1,109 @@
|
||||
---
|
||||
title: CloseButton 关闭按钮
|
||||
description: 用于关闭对话框、模态框或 dismiss 内容的按钮组件
|
||||
component: close-button
|
||||
group: 组件
|
||||
---
|
||||
|
||||
## 用法
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import { CloseButton } from "@heroui-vue/components";
|
||||
</script>
|
||||
```
|
||||
|
||||
<ComponentPreview name="close-button-default" />
|
||||
|
||||
## 示例
|
||||
|
||||
### 交互
|
||||
|
||||
<ComponentPreview name="close-button-interactive" />
|
||||
|
||||
### 自定义图标
|
||||
|
||||
<ComponentPreview name="close-button-with-custom-icon" />
|
||||
|
||||
## 自定义样式
|
||||
|
||||
### Tailwind CSS
|
||||
|
||||
<ComponentPreview name="close-button-custom-styles" />
|
||||
|
||||
### 全局 CSS
|
||||
|
||||
可使用 `@layer components` 指令自定义 CloseButton 组件类。
|
||||
|
||||
```css
|
||||
@layer components {
|
||||
.hv-close-button {
|
||||
@apply bg-red-100 text-red-800 hover:bg-red-200;
|
||||
}
|
||||
|
||||
.hv-close-button--custom {
|
||||
@apply rounded-full border-2 border-red-300;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 样式参考
|
||||
|
||||
HeroUI 遵循 [BEM](https://getbem.com/) 方法论,确保组件变体与状态可复用且易于自定义。
|
||||
|
||||
### CSS 类
|
||||
|
||||
CloseButton 组件使用以下 CSS 类:
|
||||
|
||||
#### 基础类 [!toc]
|
||||
|
||||
- `.hv-close-button` - 基础组件样式
|
||||
|
||||
#### 变体类 [!toc]
|
||||
|
||||
- `.hv-close-button--default` - 默认变体
|
||||
|
||||
### 交互状态
|
||||
|
||||
组件同时支持 CSS 伪类与 data 属性:
|
||||
|
||||
- **Hover**:`:hover` 或 `[data-hovered="true"]`
|
||||
- **Active/Pressed**:`:active` 或 `[data-pressed="true"]`
|
||||
- **Focus**:`:focus-visible` 或 `[data-focus-visible="true"]`
|
||||
- **Disabled**:`:disabled` 或 `[aria-disabled="true"]`
|
||||
|
||||
## API 参考
|
||||
|
||||
### CloseButton
|
||||
|
||||
| Prop | 类型 | 默认值 | 描述 |
|
||||
| ------------ | --------------------- | ------------ | -------------------------- |
|
||||
| `variant` | `"default"` | `"default"` | 按钮视觉变体 |
|
||||
| `isDisabled` | `boolean` | `false` | 是否禁用 |
|
||||
| 默认插槽 | `string \| Component` | 内置关闭图标 | 显示内容(默认为关闭图标) |
|
||||
|
||||
### 原生按钮属性
|
||||
|
||||
CloseButton 是原生 `button`,`type` 固定为 `"button"`。常用属性包括:
|
||||
|
||||
| Prop | 类型 | 描述 |
|
||||
| ------------------ | -------- | ------------------------------------ |
|
||||
| `aria-label` | `string` | 屏幕阅读器的无障碍标签,默认 `Close` |
|
||||
| `aria-labelledby` | `string` | 标注按钮的元素 ID |
|
||||
| `aria-describedby` | `string` | 描述按钮的元素 ID |
|
||||
|
||||
### 作用域插槽状态
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
| ---------------- | --------- | ---------------------- |
|
||||
| `isHovered` | `boolean` | 是否悬停 |
|
||||
| `isPressed` | `boolean` | 是否按下 |
|
||||
| `isFocused` | `boolean` | 是否聚焦 |
|
||||
| `isFocusVisible` | `boolean` | 是否显示键盘焦点指示器 |
|
||||
| `isDisabled` | `boolean` | 是否禁用 |
|
||||
|
||||
`onPress` 与 React Aria 的 PressEvent 不直接等价;Vue 使用原生 `@click` 与键盘事件。默认关闭图标来自固定基线 `CloseIcon`,可通过插槽替换为任意图标组件。
|
||||
|
||||
## 相关组件
|
||||
|
||||
[Button 按钮](./button) · [Card 卡片](./card)
|
||||
@@ -0,0 +1,185 @@
|
||||
---
|
||||
title: Skeleton 骨架屏
|
||||
description: Skeleton 用于展示加载状态,并预览组件的预期形状。
|
||||
component: skeleton
|
||||
group: 组件
|
||||
---
|
||||
|
||||
## 用法
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
```
|
||||
|
||||
<ComponentPreview name="skeleton-basic" />
|
||||
|
||||
## 示例
|
||||
|
||||
### 文本内容
|
||||
|
||||
<ComponentPreview name="skeleton-text-content" />
|
||||
|
||||
### 用户资料
|
||||
|
||||
<ComponentPreview name="skeleton-user-profile" />
|
||||
|
||||
### 列表项
|
||||
|
||||
<ComponentPreview name="skeleton-list" />
|
||||
|
||||
### 网格
|
||||
|
||||
<ComponentPreview name="skeleton-grid" />
|
||||
|
||||
### 单次闪烁
|
||||
|
||||
同步的 shimmer 效果会一次性扫过所有骨架元素。在父容器上应用 `hv-skeleton--shimmer` 类,并将子骨架的 `animationType` 设为 `"none"`。
|
||||
|
||||
<ComponentPreview name="skeleton-single-shimmer" />
|
||||
|
||||
### 动画类型
|
||||
|
||||
<ComponentPreview name="skeleton-animation-types" />
|
||||
|
||||
## 自定义样式
|
||||
|
||||
### Tailwind CSS
|
||||
|
||||
<ComponentPreview name="skeleton-custom-styles" />
|
||||
|
||||
### 全局 CSS
|
||||
|
||||
若要自定义组件类,可使用 `@layer components` 指令。
|
||||
|
||||
```css
|
||||
@layer components {
|
||||
/* Base skeleton styles */
|
||||
.hv-skeleton {
|
||||
@apply bg-surface-secondary/50; /* Change base background */
|
||||
}
|
||||
|
||||
/* Shimmer animation gradient */
|
||||
.hv-skeleton--shimmer::after {
|
||||
@apply via-surface-tertiary; /* Change shimmer gradient color */
|
||||
}
|
||||
|
||||
/* Pulse animation */
|
||||
.hv-skeleton--pulse {
|
||||
@apply animate-pulse opacity-75; /* Customize pulse animation */
|
||||
}
|
||||
|
||||
/* No animation variant */
|
||||
.hv-skeleton--none {
|
||||
@apply opacity-50; /* Style for static skeleton */
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 全局动画配置
|
||||
|
||||
可在全局 CSS 中通过 `--skeleton-animation` 变量为所有 Skeleton 组件设置默认动画类型:
|
||||
|
||||
```css
|
||||
/* 全局 CSS 文件 */
|
||||
:root {
|
||||
/* 可选值:shimmer、pulse、none */
|
||||
--skeleton-animation: pulse;
|
||||
}
|
||||
|
||||
/* 也可为浅色/深色主题设置不同值 */
|
||||
.light,
|
||||
[data-theme="light"] {
|
||||
--skeleton-animation: shimmer;
|
||||
}
|
||||
|
||||
.dark,
|
||||
[data-theme="dark"] {
|
||||
--skeleton-animation: pulse;
|
||||
}
|
||||
```
|
||||
|
||||
在单个组件上指定 `animation-type` 属性会覆盖此全局设置。
|
||||
|
||||
## 样式参考
|
||||
|
||||
HeroUI 遵循 [BEM](https://getbem.com/) 方法论,确保组件变体与状态可复用且易于自定义。
|
||||
|
||||
### CSS 类
|
||||
|
||||
Skeleton 使用以下 CSS 类:
|
||||
|
||||
#### 基础类 [!toc]
|
||||
|
||||
`.hv-skeleton` - 包含背景与圆角等基础骨架样式
|
||||
|
||||
#### 动画变体类 [!toc]
|
||||
|
||||
- `.hv-skeleton--shimmer` - 添加带渐变效果的闪烁动画(默认)
|
||||
- `.hv-skeleton--pulse` - 使用 Tailwind 的 `animate-pulse` 添加脉冲动画
|
||||
- `.hv-skeleton--none` - 无动画的静态骨架
|
||||
|
||||
### 动画
|
||||
|
||||
Skeleton 支持三种动画类型,视觉效果各不相同:
|
||||
|
||||
#### 闪烁动画 [!toc]
|
||||
|
||||
闪烁效果会在骨架元素上移动渐变:
|
||||
|
||||
```css
|
||||
.hv-skeleton--shimmer::after {
|
||||
@apply absolute inset-0 -translate-x-full animate-skeleton
|
||||
bg-linear-to-r from-transparent via-surface-tertiary to-transparent content-[''];
|
||||
}
|
||||
```
|
||||
|
||||
闪烁动画在主题中通过以下方式定义:
|
||||
|
||||
```css
|
||||
@theme inline {
|
||||
--animate-skeleton: skeleton 2s linear infinite;
|
||||
|
||||
@keyframes skeleton {
|
||||
100% {
|
||||
transform: translateX(200%);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 脉冲动画 [!toc]
|
||||
|
||||
脉冲动画使用 Tailwind 内置的 `animate-pulse` 工具类:
|
||||
|
||||
```css
|
||||
.hv-skeleton--pulse {
|
||||
@apply animate-pulse;
|
||||
}
|
||||
```
|
||||
|
||||
#### 无动画 [!toc]
|
||||
|
||||
用于不需要任何动画的静态骨架:
|
||||
|
||||
```css
|
||||
.hv-skeleton--none {
|
||||
/* No animation styles applied */
|
||||
}
|
||||
```
|
||||
|
||||
## API 参考
|
||||
|
||||
### Skeleton
|
||||
|
||||
| Prop | 类型 | 默认值 | 描述 |
|
||||
| --------------- | -------------------------------- | ----------------------- | ------------------------------------------------------------------------- |
|
||||
| `animationType` | `"shimmer" \| "pulse" \| "none"` | `"shimmer"` 或 CSS 变量 | Skeleton 的动画类型;也可通过 `--skeleton-animation` CSS 变量进行全局配置 |
|
||||
| `class` | `string` | - | 额外的 CSS 类名 |
|
||||
|
||||
`animationType` 未指定时,客户端挂载后读取 `--skeleton-animation`;服务端渲染与首次客户端渲染使用 `"shimmer"` 兜底。挂载后修改该 CSS 变量不会自动更新已渲染的 Skeleton。
|
||||
|
||||
## 相关组件
|
||||
|
||||
[Card 卡片](./card) · [Spinner 加载指示器](./spinner)
|
||||
@@ -0,0 +1,24 @@
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex items-center gap-4">
|
||||
<Avatar>
|
||||
<AvatarImage
|
||||
alt="约翰·多伊"
|
||||
src="https://img.heroui.chat/image/avatar?w=400&h=400&u=3"
|
||||
/>
|
||||
<AvatarFallback>JD</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarImage
|
||||
alt="蓝色头像"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg"
|
||||
/>
|
||||
<AvatarFallback>B</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarFallback>JR</AvatarFallback>
|
||||
</Avatar>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarFallback } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex items-center gap-4">
|
||||
<Avatar color="default">
|
||||
<AvatarFallback>DF</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar color="accent">
|
||||
<AvatarFallback>AC</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar color="success">
|
||||
<AvatarFallback>SC</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar color="warning">
|
||||
<AvatarFallback>WR</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar color="danger">
|
||||
<AvatarFallback>DG</AvatarFallback>
|
||||
</Avatar>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,37 @@
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
|
||||
import { defineComponent, h } from "vue";
|
||||
|
||||
const SRC =
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg";
|
||||
|
||||
/** Stand-in for a framework image component (e.g. Next.js Image). */
|
||||
const FrameworkImage = defineComponent({
|
||||
name: "FrameworkImage",
|
||||
inheritAttrs: false,
|
||||
props: {
|
||||
src: { type: String, required: true },
|
||||
alt: { type: String, default: "" },
|
||||
width: { type: [Number, String], default: 40 },
|
||||
height: { type: [Number, String], default: 40 },
|
||||
},
|
||||
setup(props, { attrs }) {
|
||||
return () =>
|
||||
h("img", {
|
||||
...attrs,
|
||||
src: props.src,
|
||||
alt: props.alt,
|
||||
width: props.width,
|
||||
height: props.height,
|
||||
});
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<Avatar>
|
||||
<AvatarImage :src="SRC" as-child>
|
||||
<FrameworkImage :src="SRC" alt="约翰·多伊" :width="40" :height="40" />
|
||||
</AvatarImage>
|
||||
<AvatarFallback>JD</AvatarFallback>
|
||||
</Avatar>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<Avatar class="rounded-lg">
|
||||
<AvatarImage
|
||||
alt="张三"
|
||||
src="https://img.heroui.chat/image/avatar?w=400&h=400&u=3"
|
||||
/>
|
||||
<AvatarFallback class="rounded-lg">张三</AvatarFallback>
|
||||
</Avatar>
|
||||
</template>
|
||||
@@ -0,0 +1,37 @@
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
|
||||
import { IconUser } from "@tabler/icons-vue";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex items-center gap-4">
|
||||
<!-- 文字回退 -->
|
||||
<Avatar>
|
||||
<AvatarFallback>JD</AvatarFallback>
|
||||
</Avatar>
|
||||
|
||||
<!-- 图标回退 -->
|
||||
<Avatar>
|
||||
<AvatarFallback>
|
||||
<IconUser aria-hidden="true" class="size-4 shrink-0" />
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
|
||||
<!-- 延迟显示回退 -->
|
||||
<Avatar>
|
||||
<AvatarImage
|
||||
alt="延迟加载头像"
|
||||
src="https://invalid-url-to-show-fallback.com/image.jpg"
|
||||
/>
|
||||
<AvatarFallback :delay-ms="600">NA</AvatarFallback>
|
||||
</Avatar>
|
||||
|
||||
<!-- 自定义样式回退 -->
|
||||
<Avatar>
|
||||
<AvatarFallback
|
||||
class="border-none bg-gradient-to-br from-pink-500 to-purple-500 text-white"
|
||||
>
|
||||
GB
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,59 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const users = [
|
||||
{
|
||||
id: 1,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg",
|
||||
name: "张明",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg",
|
||||
name: "李华",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg",
|
||||
name: "王芳",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/orange.jpg",
|
||||
name: "刘洋",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/red.jpg",
|
||||
name: "陈静",
|
||||
},
|
||||
];
|
||||
|
||||
function initialsFromName(name: string) {
|
||||
const parts = name.split(/\s+/).filter(Boolean);
|
||||
|
||||
if (parts.length >= 2) {
|
||||
return parts.map((n) => n[0]).join("");
|
||||
}
|
||||
|
||||
return name.slice(0, 2);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<AvatarGroup>
|
||||
<Avatar v-for="user in users.slice(0, 4)" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ initialsFromName(user.name) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
</AvatarGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,63 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarGroupCount,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const users = [
|
||||
{
|
||||
id: 1,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg",
|
||||
name: "张明",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg",
|
||||
name: "李华",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg",
|
||||
name: "王芳",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/orange.jpg",
|
||||
name: "刘洋",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/red.jpg",
|
||||
name: "陈静",
|
||||
},
|
||||
];
|
||||
|
||||
function initialsFromName(name: string) {
|
||||
const parts = name.split(/\s+/).filter(Boolean);
|
||||
|
||||
if (parts.length >= 2) {
|
||||
return parts.map((n) => n[0]).join("");
|
||||
}
|
||||
|
||||
return name.slice(0, 2);
|
||||
}
|
||||
|
||||
const total = 12;
|
||||
</script>
|
||||
<template>
|
||||
<AvatarGroup size="sm">
|
||||
<Avatar v-for="user in users.slice(0, 3)" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ initialsFromName(user.name) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
<AvatarGroupCount>+{{ total - 3 }}</AvatarGroupCount>
|
||||
</AvatarGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,56 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarGroupCount,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
import { IconUser } from "@tabler/icons-vue";
|
||||
|
||||
const assignees = [
|
||||
{
|
||||
id: 1,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg",
|
||||
name: "张明",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg",
|
||||
name: "李华",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg",
|
||||
name: "王芳",
|
||||
},
|
||||
] as const;
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
class="inline-flex items-center gap-2.5 rounded-full border border-border/70 bg-surface/95 py-1 pr-3 pl-1 shadow-sm ring-1 ring-black/[0.04] dark:border-border/80 dark:bg-surface/90 dark:ring-white/10"
|
||||
>
|
||||
<AvatarGroup
|
||||
aria-label="指派人"
|
||||
class="[--avatar-group-overlap:0.7rem] [--avatar-group-seam:2px]"
|
||||
overlap="clip"
|
||||
role="group"
|
||||
size="sm"
|
||||
>
|
||||
<Avatar v-for="user in assignees" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ user.name.slice(0, 1) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarFallback>
|
||||
<IconUser aria-hidden="true" class="size-4 shrink-0" />
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<AvatarGroupCount>+3</AvatarGroupCount>
|
||||
</AvatarGroup>
|
||||
<span class="text-sm font-medium text-foreground">指派人</span>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,59 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const users = [
|
||||
{
|
||||
id: 1,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg",
|
||||
name: "张明",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg",
|
||||
name: "李华",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg",
|
||||
name: "王芳",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/orange.jpg",
|
||||
name: "刘洋",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/red.jpg",
|
||||
name: "陈静",
|
||||
},
|
||||
];
|
||||
|
||||
function initialsFromName(name: string) {
|
||||
const parts = name.split(/\s+/).filter(Boolean);
|
||||
|
||||
if (parts.length >= 2) {
|
||||
return parts.map((n) => n[0]).join("");
|
||||
}
|
||||
|
||||
return name.slice(0, 2);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<AvatarGroup is-grid :max="5">
|
||||
<Avatar v-for="user in users" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ initialsFromName(user.name) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
</AvatarGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,59 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const users = [
|
||||
{
|
||||
id: 1,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg",
|
||||
name: "张明",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg",
|
||||
name: "李华",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg",
|
||||
name: "王芳",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/orange.jpg",
|
||||
name: "刘洋",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/red.jpg",
|
||||
name: "陈静",
|
||||
},
|
||||
];
|
||||
|
||||
function initialsFromName(name: string) {
|
||||
const parts = name.split(/\s+/).filter(Boolean);
|
||||
|
||||
if (parts.length >= 2) {
|
||||
return parts.map((n) => n[0]).join("");
|
||||
}
|
||||
|
||||
return name.slice(0, 2);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<AvatarGroup :max="3">
|
||||
<Avatar v-for="user in users" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ initialsFromName(user.name) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
</AvatarGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,104 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarGroupCount,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@keyframes ag-stripes {
|
||||
to {
|
||||
background-position: 24px 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.ag-stripes {
|
||||
background-color: color-mix(in oklab, var(--danger) 6%, var(--surface));
|
||||
background-image: repeating-linear-gradient(
|
||||
-45deg,
|
||||
transparent 0 10px,
|
||||
color-mix(in oklab, var(--danger) 12%, transparent) 10px 11px,
|
||||
transparent 11px 21px,
|
||||
color-mix(in oklab, var(--danger) 28%, transparent) 21px 22px
|
||||
);
|
||||
background-size: 24px 24px;
|
||||
animation: ag-stripes 2.8s linear infinite;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col items-start gap-6">
|
||||
<div class="flex flex-col gap-2">
|
||||
<p class="text-sm text-muted">clip</p>
|
||||
<div class="relative inline-flex rounded-xl p-6">
|
||||
<div
|
||||
aria-hidden
|
||||
class="ag-stripes pointer-events-none absolute inset-0 rounded-xl"
|
||||
/>
|
||||
<div class="relative z-10">
|
||||
<AvatarGroup overlap="clip" size="lg">
|
||||
<Avatar>
|
||||
<AvatarImage
|
||||
alt="John"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg"
|
||||
/>
|
||||
<AvatarFallback>JD</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarFallback>AB</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarImage
|
||||
alt="Emily"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg"
|
||||
/>
|
||||
<AvatarFallback>EC</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarFallback>SM</AvatarFallback>
|
||||
</Avatar>
|
||||
<AvatarGroupCount>+2</AvatarGroupCount>
|
||||
</AvatarGroup>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-2">
|
||||
<p class="text-sm text-muted">ring</p>
|
||||
<div class="relative inline-flex rounded-xl p-6">
|
||||
<div
|
||||
aria-hidden
|
||||
class="ag-stripes pointer-events-none absolute inset-0 rounded-xl"
|
||||
/>
|
||||
<div class="relative z-10">
|
||||
<AvatarGroup overlap="ring" size="lg">
|
||||
<Avatar>
|
||||
<AvatarImage
|
||||
alt="John"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg"
|
||||
/>
|
||||
<AvatarFallback>JD</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarFallback>AB</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarImage
|
||||
alt="Emily"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg"
|
||||
/>
|
||||
<AvatarFallback>EC</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar>
|
||||
<AvatarFallback>SM</AvatarFallback>
|
||||
</Avatar>
|
||||
<AvatarGroupCount>+2</AvatarGroupCount>
|
||||
</AvatarGroup>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,82 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarGroup,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const users = [
|
||||
{
|
||||
id: 1,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg",
|
||||
name: "张明",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg",
|
||||
name: "李华",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg",
|
||||
name: "王芳",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/orange.jpg",
|
||||
name: "刘洋",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
image:
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/red.jpg",
|
||||
name: "陈静",
|
||||
},
|
||||
];
|
||||
|
||||
function initialsFromName(name: string) {
|
||||
const parts = name.split(/\s+/).filter(Boolean);
|
||||
|
||||
if (parts.length >= 2) {
|
||||
return parts.map((n) => n[0]).join("");
|
||||
}
|
||||
|
||||
return name.slice(0, 2);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-col items-center gap-6">
|
||||
<div class="flex flex-col items-center gap-2">
|
||||
<p class="text-sm text-muted">小号</p>
|
||||
<AvatarGroup size="sm">
|
||||
<Avatar v-for="user in users.slice(0, 4)" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ initialsFromName(user.name) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
</AvatarGroup>
|
||||
</div>
|
||||
<div class="flex flex-col items-center gap-2">
|
||||
<p class="text-sm text-muted">中号(默认)</p>
|
||||
<AvatarGroup size="md">
|
||||
<Avatar v-for="user in users.slice(0, 4)" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ initialsFromName(user.name) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
</AvatarGroup>
|
||||
</div>
|
||||
<div class="flex flex-col items-center gap-2">
|
||||
<p class="text-sm text-muted">大号</p>
|
||||
<AvatarGroup size="lg">
|
||||
<Avatar v-for="user in users.slice(0, 4)" :key="user.id">
|
||||
<AvatarImage :alt="`${user.name} 的头像`" :src="user.image" />
|
||||
<AvatarFallback>{{ initialsFromName(user.name) }}</AvatarFallback>
|
||||
</Avatar>
|
||||
</AvatarGroup>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex items-center gap-4">
|
||||
<Avatar size="sm">
|
||||
<AvatarImage
|
||||
alt="小尺寸头像"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg"
|
||||
/>
|
||||
<AvatarFallback>SM</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar size="md">
|
||||
<AvatarImage
|
||||
alt="中尺寸头像"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg"
|
||||
/>
|
||||
<AvatarFallback>MD</AvatarFallback>
|
||||
</Avatar>
|
||||
<Avatar size="lg">
|
||||
<AvatarImage
|
||||
alt="大尺寸头像"
|
||||
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/red.jpg"
|
||||
/>
|
||||
<AvatarFallback>LG</AvatarFallback>
|
||||
</Avatar>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,84 @@
|
||||
<script setup lang="ts">
|
||||
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
|
||||
import { IconUser } from "@tabler/icons-vue";
|
||||
|
||||
const colors = ["accent", "default", "success", "warning", "danger"] as const;
|
||||
|
||||
const COLOR_LABELS: Record<(typeof colors)[number], string> = {
|
||||
accent: "强调",
|
||||
danger: "危险",
|
||||
default: "默认",
|
||||
success: "成功",
|
||||
warning: "警告",
|
||||
};
|
||||
|
||||
const variants = [
|
||||
{ content: "AG", label: "字母", type: "letter" },
|
||||
{ content: "AG", label: "柔和字母", type: "letter-soft" },
|
||||
{ content: "icon", label: "图标", type: "icon" },
|
||||
{ content: "icon", label: "柔和图标", type: "icon-soft" },
|
||||
{
|
||||
content: [
|
||||
"https://img.heroui.chat/image/avatar?w=400&h=400&u=3",
|
||||
"https://img.heroui.chat/image/avatar?w=400&h=400&u=4",
|
||||
"https://img.heroui.chat/image/avatar?w=400&h=400&u=5",
|
||||
"https://img.heroui.chat/image/avatar?w=400&h=400&u=8",
|
||||
"https://img.heroui.chat/image/avatar?w=400&h=400&u=16",
|
||||
],
|
||||
label: "图片",
|
||||
type: "img",
|
||||
},
|
||||
] as const;
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<!-- 颜色列标题 -->
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-24 shrink-0" />
|
||||
<div
|
||||
v-for="color in colors"
|
||||
:key="color"
|
||||
class="flex w-20 shrink-0 items-center justify-center"
|
||||
>
|
||||
<span class="text-xs text-muted">{{ COLOR_LABELS[color] }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="h-px w-full bg-separator" />
|
||||
|
||||
<!-- 变体行 -->
|
||||
<div
|
||||
v-for="variant in variants"
|
||||
:key="variant.label"
|
||||
class="flex items-center gap-3"
|
||||
>
|
||||
<div class="w-24 shrink-0 text-sm text-muted">{{ variant.label }}</div>
|
||||
<div
|
||||
v-for="(color, colorIndex) in colors"
|
||||
:key="color"
|
||||
class="flex w-20 shrink-0 items-center justify-center"
|
||||
>
|
||||
<Avatar
|
||||
:color="color"
|
||||
:variant="variant.type.includes('soft') ? 'soft' : undefined"
|
||||
>
|
||||
<template v-if="variant.type === 'img'">
|
||||
<AvatarImage
|
||||
:alt="`${COLOR_LABELS[color]} 头像`"
|
||||
:src="
|
||||
Array.isArray(variant.content)
|
||||
? variant.content[colorIndex]
|
||||
: ''
|
||||
"
|
||||
/>
|
||||
<AvatarFallback>{{ COLOR_LABELS[color].charAt(0) }}</AvatarFallback>
|
||||
</template>
|
||||
<AvatarFallback v-else-if="variant.content === 'icon'">
|
||||
<IconUser aria-hidden="true" class="size-4 shrink-0" />
|
||||
</AvatarFallback>
|
||||
<AvatarFallback v-else>{{ variant.content }}</AvatarFallback>
|
||||
</Avatar>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,6 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { closeButtonVariants } from "@heroui-vue/styles";
|
||||
import { IconX } from "@tabler/icons-vue";
|
||||
import {
|
||||
Card,
|
||||
CardHeader,
|
||||
@@ -8,6 +6,7 @@ import {
|
||||
CardDescription,
|
||||
CardFooter,
|
||||
Button,
|
||||
CloseButton,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
@@ -28,14 +27,7 @@ import {
|
||||
<CardDescription>
|
||||
这是一段占位说明文字,用于展示横向卡片布局、配图与右上角关闭按钮的排版效果。
|
||||
</CardDescription>
|
||||
<button
|
||||
type="button"
|
||||
:class="closeButtonVariants()"
|
||||
aria-label="关闭横幅"
|
||||
class="absolute end-3 top-3"
|
||||
>
|
||||
<IconX aria-hidden="true" />
|
||||
</button>
|
||||
<CloseButton aria-label="关闭横幅" class="absolute end-3 top-3" />
|
||||
</CardHeader>
|
||||
<CardFooter
|
||||
class="mt-auto flex w-full flex-col items-start gap-3 sm:flex-row sm:items-center sm:justify-between"
|
||||
|
||||
@@ -5,8 +5,10 @@ import {
|
||||
CardTitle,
|
||||
CardDescription,
|
||||
CardFooter,
|
||||
Avatar,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
} from "@heroui-vue/components";
|
||||
import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-wrap gap-4">
|
||||
@@ -22,7 +24,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
<CardDescription>148 位成员</CardDescription>
|
||||
</CardHeader>
|
||||
<CardFooter class="flex gap-2">
|
||||
<AvatarRoot
|
||||
<Avatar
|
||||
aria-label="玛莎的头像"
|
||||
class="inline-flex shrink-0 overflow-hidden rounded-full size-5"
|
||||
>
|
||||
@@ -36,7 +38,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
>
|
||||
IH
|
||||
</AvatarFallback>
|
||||
</AvatarRoot>
|
||||
</Avatar>
|
||||
<span class="text-xs">创建者:玛莎</span>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
@@ -53,7 +55,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
<CardDescription>362 位成员</CardDescription>
|
||||
</CardHeader>
|
||||
<CardFooter class="flex gap-2">
|
||||
<AvatarRoot
|
||||
<Avatar
|
||||
aria-label="约翰的头像"
|
||||
class="inline-flex shrink-0 overflow-hidden rounded-full size-5"
|
||||
>
|
||||
@@ -67,7 +69,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
>
|
||||
B
|
||||
</AvatarFallback>
|
||||
</AvatarRoot>
|
||||
</Avatar>
|
||||
<span class="text-xs">创建者:约翰</span>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { closeButtonVariants } from "@heroui-vue/styles";
|
||||
import { IconX } from "@tabler/icons-vue";
|
||||
import { IconCoin } from "@tabler/icons-vue";
|
||||
import {
|
||||
Card,
|
||||
@@ -10,10 +8,13 @@ import {
|
||||
CardContent,
|
||||
CardFooter,
|
||||
Button,
|
||||
CloseButton,
|
||||
Avatar,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
Link,
|
||||
LinkIcon,
|
||||
} from "@heroui-vue/components";
|
||||
import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex w-full items-center justify-center">
|
||||
@@ -35,14 +36,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
<CardDescription>
|
||||
这是一段占位说明文字,用于展示横向卡片布局、配图与右上角关闭按钮的排版效果。
|
||||
</CardDescription>
|
||||
<button
|
||||
type="button"
|
||||
:class="closeButtonVariants()"
|
||||
aria-label="关闭横幅"
|
||||
class="absolute end-3 top-3"
|
||||
>
|
||||
<IconX aria-hidden="true" />
|
||||
</button>
|
||||
<CloseButton aria-label="关闭横幅" class="absolute end-3 top-3" />
|
||||
</CardHeader>
|
||||
<CardFooter
|
||||
class="mt-auto flex w-full flex-col items-start gap-3 sm:flex-row sm:items-center sm:justify-between"
|
||||
@@ -62,13 +56,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
<div class="col-span-12 grid grid-cols-12 gap-4 lg:col-span-6">
|
||||
<Card class="col-span-12">
|
||||
<div class="absolute end-3 top-3 z-10">
|
||||
<button
|
||||
type="button"
|
||||
:class="closeButtonVariants()"
|
||||
aria-label="关闭通知"
|
||||
>
|
||||
<IconX aria-hidden="true" />
|
||||
</button>
|
||||
<CloseButton aria-label="关闭通知" />
|
||||
</div>
|
||||
<CardHeader class="gap-3">
|
||||
<IconCoin
|
||||
@@ -99,7 +87,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
<div class="col-span-12 grid grid-cols-12 gap-4">
|
||||
<Card class="col-span-12 gap-2 sm:col-span-6">
|
||||
<CardHeader>
|
||||
<AvatarRoot
|
||||
<Avatar
|
||||
class="inline-flex shrink-0 overflow-hidden rounded-full size-[56px] rounded-xl"
|
||||
>
|
||||
<AvatarImage
|
||||
@@ -112,14 +100,14 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
>
|
||||
JK
|
||||
</AvatarFallback>
|
||||
</AvatarRoot>
|
||||
</Avatar>
|
||||
</CardHeader>
|
||||
<CardContent class="mt-1">
|
||||
<p class="text-sm leading-4 font-medium">Indie Hackers</p>
|
||||
<p class="text-xs text-muted">148 位成员</p>
|
||||
</CardContent>
|
||||
<CardFooter class="flex items-center gap-2">
|
||||
<AvatarRoot
|
||||
<Avatar
|
||||
class="inline-flex shrink-0 overflow-hidden rounded-full size-4"
|
||||
>
|
||||
<AvatarImage
|
||||
@@ -132,14 +120,14 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
>
|
||||
JK
|
||||
</AvatarFallback>
|
||||
</AvatarRoot>
|
||||
</Avatar>
|
||||
<p class="text-xs text-muted">创建者:约翰</p>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
|
||||
<Card class="col-span-12 gap-2 sm:col-span-6">
|
||||
<CardHeader>
|
||||
<AvatarRoot
|
||||
<Avatar
|
||||
class="inline-flex shrink-0 overflow-hidden rounded-full size-[56px] rounded-xl"
|
||||
>
|
||||
<AvatarImage
|
||||
@@ -152,14 +140,14 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
>
|
||||
AB
|
||||
</AvatarFallback>
|
||||
</AvatarRoot>
|
||||
</Avatar>
|
||||
</CardHeader>
|
||||
<CardContent class="mt-1">
|
||||
<p class="text-sm leading-4 font-medium">AI Builders</p>
|
||||
<p class="text-xs text-muted">362 位成员</p>
|
||||
</CardContent>
|
||||
<CardFooter class="flex items-center gap-2">
|
||||
<AvatarRoot
|
||||
<Avatar
|
||||
class="inline-flex shrink-0 overflow-hidden rounded-full size-4"
|
||||
>
|
||||
<AvatarImage
|
||||
@@ -172,7 +160,7 @@ import { AvatarRoot, AvatarImage, AvatarFallback } from "reka-ui";
|
||||
>
|
||||
M
|
||||
</AvatarFallback>
|
||||
</AvatarRoot>
|
||||
</Avatar>
|
||||
<p class="text-xs text-muted">创建者:玛莎</p>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { CloseButton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<CloseButton
|
||||
aria-label="关闭"
|
||||
class="size-8 rounded-full bg-default text-muted hover:bg-default-hover hover:text-foreground active:scale-95"
|
||||
/>
|
||||
</template>
|
||||
@@ -0,0 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { CloseButton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<CloseButton />
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { CloseButton } from "@heroui-vue/components";
|
||||
|
||||
const count = ref(0);
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-col items-center justify-center gap-4">
|
||||
<CloseButton :aria-label="`关闭(已点击 ${count} 次)`" @click="count++" />
|
||||
<span class="text-sm text-muted">已点击:{{ count }} 次</span>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import { CloseButton } from "@heroui-vue/components";
|
||||
import { IconCircleX, IconX } from "@tabler/icons-vue";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="flex flex-col items-center gap-2">
|
||||
<CloseButton>
|
||||
<IconCircleX aria-hidden="true" />
|
||||
</CloseButton>
|
||||
<span class="text-xs text-muted">自定义图标</span>
|
||||
</div>
|
||||
<div class="flex flex-col items-center gap-2">
|
||||
<CloseButton>
|
||||
<IconX aria-hidden="true" />
|
||||
</CloseButton>
|
||||
<span class="text-xs text-muted">备选图标</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,35 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
class="grid w-full max-w-xl grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3"
|
||||
>
|
||||
<div class="space-y-2">
|
||||
<p class="truncate text-xs text-muted">微光</p>
|
||||
<div class="shadow-panel space-y-3 rounded-lg bg-transparent p-4">
|
||||
<Skeleton animation-type="shimmer" class="h-20 rounded-lg" />
|
||||
<Skeleton animation-type="shimmer" class="h-3 w-3/5 rounded-lg" />
|
||||
<Skeleton animation-type="shimmer" class="h-3 w-4/5 rounded-lg" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<p class="truncate text-xs text-muted">脉冲</p>
|
||||
<div class="shadow-panel space-y-3 rounded-lg bg-transparent p-4">
|
||||
<Skeleton animation-type="pulse" class="h-20 rounded-lg" />
|
||||
<Skeleton animation-type="pulse" class="h-3 w-3/5 rounded-lg" />
|
||||
<Skeleton animation-type="pulse" class="h-3 w-4/5 rounded-lg" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<p class="truncate text-xs text-muted">无</p>
|
||||
<div class="shadow-panel space-y-3 rounded-lg bg-transparent p-4">
|
||||
<Skeleton animation-type="none" class="h-20 rounded-lg" />
|
||||
<Skeleton animation-type="none" class="h-3 w-3/5 rounded-lg" />
|
||||
<Skeleton animation-type="none" class="h-3 w-4/5 rounded-lg" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="shadow-panel w-[250px] space-y-5 rounded-lg bg-transparent p-4">
|
||||
<Skeleton class="h-32 rounded-lg" />
|
||||
<div class="space-y-3">
|
||||
<Skeleton class="h-3 w-3/5 rounded-lg" />
|
||||
<Skeleton class="h-3 w-4/5 rounded-lg" />
|
||||
<Skeleton class="h-3 w-2/5 rounded-lg" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
|
||||
const bone =
|
||||
"animate-shine rounded-lg bg-neutral-200/90 dark:bg-neutral-800/90";
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
class="w-[250px] space-y-5 rounded-xl border border-border/80 bg-surface p-4 shadow-sm ring-1 ring-black/5 dark:ring-white/10"
|
||||
>
|
||||
<Skeleton :class="`h-32 ${bone}`" />
|
||||
<div class="space-y-3">
|
||||
<Skeleton :class="`h-3 w-3/5 ${bone}`" />
|
||||
<Skeleton :class="`h-3 w-4/5 ${bone}`" />
|
||||
<Skeleton :class="`h-3 w-2/5 ${bone}`" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="grid w-full max-w-xl grid-cols-3 gap-4">
|
||||
<Skeleton class="h-24 rounded-xl" />
|
||||
<Skeleton class="h-24 rounded-xl" />
|
||||
<Skeleton class="h-24 rounded-xl" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="w-full max-w-sm space-y-4">
|
||||
<div v-for="index in 3" :key="index" class="flex items-center gap-3">
|
||||
<Skeleton class="h-10 w-10 shrink-0 rounded-lg" />
|
||||
<div class="flex-1 space-y-2">
|
||||
<Skeleton class="h-3 w-full rounded" />
|
||||
<Skeleton class="h-3 w-4/5 rounded" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
class="hv-skeleton--shimmer relative grid w-full max-w-xl grid-cols-3 gap-4 overflow-hidden rounded-xl"
|
||||
>
|
||||
<Skeleton animation-type="none" class="h-24 rounded-xl" />
|
||||
<Skeleton animation-type="none" class="h-24 rounded-xl" />
|
||||
<Skeleton animation-type="none" class="h-24 rounded-xl" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="w-full max-w-md space-y-3">
|
||||
<Skeleton class="h-4 w-full rounded" />
|
||||
<Skeleton class="h-4 w-5/6 rounded" />
|
||||
<Skeleton class="h-4 w-4/6 rounded" />
|
||||
<Skeleton class="h-4 w-full rounded" />
|
||||
<Skeleton class="h-4 w-3/6 rounded" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { Skeleton } from "@heroui-vue/components";
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex items-center gap-3">
|
||||
<Skeleton class="h-10 w-10 shrink-0 rounded-full" />
|
||||
<div class="flex-1 space-y-2">
|
||||
<Skeleton class="h-3 w-36 rounded-lg" />
|
||||
<Skeleton class="h-3 w-24 rounded-lg" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user