feat: add Separator Kbd and Chip components

This commit is contained in:
maoyingjie
2026-10-21 18:35:24 +08:00
parent 3d05fea7bd
commit 3515a47f5e
51 changed files with 2813 additions and 21 deletions
+3
View File
@@ -48,9 +48,12 @@ const groups = [
{ title: "AvatarGroup 头像组", url: "/components/avatar-group" },
{ title: "Button 按钮", url: "/components/button" },
{ title: "Card 卡片", url: "/components/card" },
{ title: "Chip 标签", url: "/components/chip" },
{ title: "CloseButton 关闭按钮", url: "/components/close-button" },
{ title: "Input 输入框", url: "/components/input" },
{ title: "Kbd 键盘按键", url: "/components/kbd" },
{ title: "Link 链接", url: "/components/link" },
{ title: "Separator 分隔符", url: "/components/separator" },
{ title: "Skeleton 骨架屏", url: "/components/skeleton" },
{ title: "Spinner 加载指示器", url: "/components/spinner" },
{ title: "Surface 表面", url: "/components/surface" },
+3
View File
@@ -7,9 +7,12 @@ description: 已迁移组件及文档
- [AvatarGroup 头像组](./components/avatar-group)
- [Button 按钮](./components/button)
- [Card 卡片](./components/card)
- [Chip 标签](./components/chip)
- [CloseButton 关闭按钮](./components/close-button)
- [Input 输入框](./components/input)
- [Kbd 键盘按键](./components/kbd)
- [Link 链接](./components/link)
- [Separator 分隔符](./components/separator)
- [Skeleton 骨架屏](./components/skeleton)
- [Spinner 加载指示器](./components/spinner)
- [Surface 表面](./components/surface)
+160
View File
@@ -0,0 +1,160 @@
---
title: Chip 标签
description: 用于显示标签、状态与分类的小型信息徽章
component: chip
group: 组件
---
## 用法
```vue
<script setup lang="ts">
import { Chip } from "@heroui-vue/components";
</script>
```
<ComponentPreview name="chip-basic" />
## 组件结构
> 纯文本子节点会自动包裹在 `<ChipLabel>` 中。
```vue
<Chip>
Label text
</Chip>
```
显式使用部件或组合内容时不会重复包装:
```vue
<Chip>
<IconCircleFilled :size="6" aria-hidden="true" />
<ChipLabel>标签</ChipLabel>
</Chip>
```
## 示例
### 变体
<ComponentPreview name="chip-variants" />
### 状态类型
<ComponentPreview name="chip-statuses" />
### 带图标
<ComponentPreview name="chip-with-icon" />
## 自定义样式
### Tailwind CSS
<ComponentPreview name="chip-custom-styles" />
### 全局 CSS
可使用 `@layer components` 指令自定义 Chip 组件类。
```css
@layer components {
.hv-chip {
@apply rounded-full text-xs;
}
.hv-chip__label {
@apply font-medium;
}
.hv-chip--accent {
@apply border-accent/20;
}
.hv-chip--accent .hv-chip__label {
@apply text-accent;
}
}
```
## 样式参考
HeroUI 遵循 [BEM](https://getbem.com/) 方法论,确保组件变体与状态可复用且易于自定义。类名前缀为 `hv-`。
### CSS 类
Chip 组件使用以下 CSS 类([查看源码样式](https://github.com/heroui-inc/heroui/blob/v3/packages/styles/components/chip.css)):
#### 基础类 [!toc]
- `.hv-chip` - 基础标签容器样式
- `.hv-chip__label` - 标签文本 slot 样式
#### 颜色类 [!toc]
- `.hv-chip--accent` - 强调色变体
- `.hv-chip--danger` - 危险色变体
- `.hv-chip--default` - 默认色变体
- `.hv-chip--success` - 成功色变体
- `.hv-chip--warning` - 警告色变体
#### 变体类 [!toc]
- `.hv-chip--primary` - 填充背景的主变体
- `.hv-chip--secondary` - 带边框的次变体
- `.hv-chip--tertiary` - 透明背景的三级变体
- `.hv-chip--soft` - 浅色背景的 soft 变体
#### 尺寸类 [!toc]
- `.hv-chip--sm` - 小尺寸
- `.hv-chip--md` - 中尺寸(默认)
- `.hv-chip--lg` - 大尺寸
#### 复合变体类 [!toc]
Chip 支持组合变体与颜色类(如 `.hv-chip--secondary.hv-chip--accent`)。以下组合有默认样式:
**Primary Variants:**
- `.hv-chip--primary.hv-chip--accent` - 填充背景的 primary accent 组合
- `.hv-chip--primary.hv-chip--success` - 填充背景的 primary success 组合
- `.hv-chip--primary.hv-chip--warning` - 填充背景的 primary warning 组合
- `.hv-chip--primary.hv-chip--danger` - 填充背景的 primary danger 组合
**Soft Variants:**
- `.hv-chip--accent.hv-chip--soft` - 浅色背景的 soft accent 组合
- `.hv-chip--success.hv-chip--soft` - 浅色背景的 soft success 组合
- `.hv-chip--warning.hv-chip--soft` - 浅色背景的 soft warning 组合
- `.hv-chip--danger.hv-chip--soft` - 浅色背景的 soft danger 组合
**Note:** 可使用 CSS 中的 `@layer components` 指令为任意变体-颜色组合(如 `.hv-chip--secondary.hv-chip--accent`、`.hv-chip--tertiary.hv-chip--success`)应用自定义样式。
## API 参考
### Chip
| Prop | 类型 | 默认值 | 描述 |
| --------- | ------------------------------------------------------------- | ------------- | --------------------------------------------------- |
| `color` | `'default' \| 'accent' \| 'success' \| 'warning' \| 'danger'` | `'default'` | 标签颜色变体 |
| `variant` | `'primary' \| 'secondary' \| 'tertiary' \| 'soft'` | `'secondary'` | 视觉样式变体 |
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | 标签尺寸 |
| 默认插槽 | `Component` | - | 标签内显示的内容;纯文本/数字自动包装为 `ChipLabel` |
| `class` | `string \| Array \| Object` | - | 附加 CSS 类(Vue class 绑定) |
### ChipLabel
| Prop | 类型 | 默认值 | 描述 |
| -------- | --------------------------- | ------ | ----------------------------- |
| 默认插槽 | `Component` | - | 标签文本内容 |
| `class` | `string \| Array \| Object` | - | 附加 CSS 类(Vue class 绑定) |
`class` 遵循 Vue 的 class 绑定,可接收字符串、数组和对象,并与组件或 slot 基础类合并;不要使用 React 的 `className`。
纯文本或数字默认插槽会在渲染时包装为 `ChipLabel`;显式 `ChipLabel` 或图标等组合内容不会重复包装。文本与组合内容之间动态切换时会按当前插槽重新判断。
## 相关组件
[Card 卡片](./card) · [Avatar 头像](./avatar)
+142
View File
@@ -0,0 +1,142 @@
---
title: Kbd 键盘按键
description: 展示键盘快捷键与按键组合
component: kbd
group: 组件
---
## 用法
```vue
<script setup lang="ts">
import { Kbd, KbdAbbr, KbdContent } from "@heroui-vue/components";
</script>
```
<ComponentPreview name="kbd-basic" />
## 组件结构
```vue
<script setup lang="ts">
import { Kbd, KbdAbbr, KbdContent } from "@heroui-vue/components";
</script>
<template>
<Kbd>
<KbdAbbr key-value="command" />
<KbdContent>K</KbdContent>
</Kbd>
</template>
```
`KbdAbbr` 根据 `keyValue` 显示按键符号,并自动设置无障碍 `title`。`KbdContent` 包裹按键字母或文本。
## 示例
### 变体
<ComponentPreview name="kbd-variants" />
### 导航按键
<ComponentPreview name="kbd-navigation-keys" />
### 行内用法
<ComponentPreview name="kbd-inline-usage" />
### 说明文字
<ComponentPreview name="kbd-instructional-text" />
### 特殊按键
<ComponentPreview name="kbd-special-keys" />
## 自定义样式
### Tailwind CSS
<ComponentPreview name="kbd-custom-styles" />
### 全局 CSS
可使用 `@layer components` 指令自定义 Kbd 组件类。
```css
@layer components {
.hv-kbd {
@apply bg-gray-100 dark:bg-gray-800 border-gray-300;
}
.hv-kbd__abbr {
@apply font-bold;
}
.hv-kbd__content {
@apply text-sm;
}
}
```
## 样式参考
HeroUI 遵循 [BEM](https://getbem.com/) 方法论,确保组件变体与状态可复用且易于自定义。类名前缀为 `hv-`。
### CSS 类
Kbd 组件使用以下 CSS 类([查看源码样式](https://github.com/heroui-inc/heroui/blob/v3/packages/styles/components/kbd.css)):
#### 基础类 [!toc]
- `.hv-kbd` - 基础按键样式,含背景、边框与间距
- `.hv-kbd__abbr` - 修饰键的缩写元素
- `.hv-kbd__content` - 按键文本的内容包裹层
## API 参考
### Kbd
| Prop | 类型 | 默认值 | 描述 |
| --------- | --------------------------- | ----------- | ----------------------------- |
| `variant` | `'default' \| 'light'` | `'default'` | 按键视觉变体 |
| 默认插槽 | `Component` | - | 按键内容 |
| `class` | `string \| Array \| Object` | - | 附加 CSS 类(Vue class 绑定) |
### KbdAbbr
| Prop | 类型 | 默认值 | 描述 |
| ---------- | --------------------------- | ------ | --------------------------------------------------------------------------- |
| `keyValue` | `KbdKey` | - | 要显示的按键;符号与 `title` 由映射表给出(如 `command` → `⌘` / `Command`) |
| `class` | `string \| Array \| Object` | - | 附加 CSS 类(Vue class 绑定) |
### KbdContent
| Prop | 类型 | 默认值 | 描述 |
| -------- | --------------------------- | ------ | ----------------------------- |
| 默认插槽 | `Component` | - | 按键文本内容 |
| `class` | `string \| Array \| Object` | - | 附加 CSS 类(Vue class 绑定) |
`class` 遵循 Vue 的 class 绑定,可接收字符串、数组和对象,并与对应 slot 的基础类合并;不要使用 React 的 `className`。
### KbdContent Type
`keyValue` prop 可用的按键值:
| Modifier Keys | Special Keys | Navigation Keys | Function Keys |
| ------------- | ------------ | --------------- | ------------- |
| `command` | `enter` | `up` | `fn` |
| `shift` | `delete` | `down` | |
| `ctrl` | `escape` | `left` | |
| `option` | `tab` | `right` | |
| `alt` | `space` | `pageup` | |
| `win` | `capslock` | `pagedown` | |
| | `help` | `home` | |
| | | `end` | |
上游文档表格曾写作 `Kbd.Key` 与 `title`/`children`;实际实现与全部演示使用 `KbdAbbr` 的 `keyValue` 与 `KbdContent`。本库按实现迁移,并同时导出 `kbdKeysMap`、`kbdKeysLabelMap` 与 `KbdKey` 类型。
## 相关组件
[Button 按钮](./button) · [Link 链接](./link)
+105
View File
@@ -0,0 +1,105 @@
---
title: Separator 分隔符
description: 在内容区块之间进行视觉分隔。
component: separator
group: 组件
---
## 用法
```vue
<script setup lang="ts">
import { Separator } from "@heroui-vue/components";
</script>
```
<ComponentPreview name="separator-basic" />
## 示例
### 变体
<ComponentPreview name="separator-variants" />
### 与 Surface 组合
Separator 组件会根据不同的表面背景自动适配,以获得更好的可见性。
<ComponentPreview name="separator-with-surface" />
### 垂直方向
<ComponentPreview name="separator-vertical" />
### 带内容
<ComponentPreview name="separator-with-content" />
### 渲染函数
Vue 使用 `as-child` 将分隔符属性合并到默认插槽中唯一的自定义根元素,对应上游 `render` 函数示例,不将 render prop 原样搬入 Vue。
<ComponentPreview name="separator-render-function" />
## 自定义样式
### Tailwind CSS
<ComponentPreview name="separator-custom-styles" />
### 全局 CSS
若要自定义组件类,可使用 `@layer components` 指令。
```css
@layer components {
.hv-separator {
@apply bg-accent h-[2px];
}
.hv-separator--vertical {
@apply bg-accent w-[2px];
}
}
```
## 样式参考
HeroUI 遵循 [BEM](https://getbem.com/) 方法论,确保组件变体与状态可复用且易于自定义。类名前缀为 `hv-`。
### CSS 类
Separator 使用以下 CSS 类([查看源码样式](https://github.com/heroui-inc/heroui/blob/v3/packages/styles/components/separator.css)):
#### 基础类与方向类 [!toc]
- `.hv-separator` - 基础 Separator 样式,默认水平方向
- `.hv-separator--horizontal` - 水平方向(全宽,高度 1px)
- `.hv-separator--vertical` - 垂直方向(全高,宽度 1px)
#### 变体类 [!toc]
- `.hv-separator--default` - 默认变体,标准对比度
- `.hv-separator--secondary` - 次要变体,中等对比度
- `.hv-separator--tertiary` - 第三级变体,较弱对比度
## API 参考
### Separator
| Prop | 类型 | 默认值 | 描述 |
| ------------- | ---------------------------------------- | -------------- | -------------------------------- |
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Separator 的方向 |
| `variant` | `'default' \| 'secondary' \| 'tertiary'` | `'default'` | Separator 的视觉变体 |
| `decorative` | `boolean` | `false` | 装饰性分隔线,使用 `role="none"` |
| `as` | `string` | `'hr'` | 自定义根元素标签 |
| `asChild` | `boolean` | `false` | 将属性合并到默认插槽唯一根元素 |
| `class` | `string \| Array \| Object` | - | 附加 CSS 类(Vue class 绑定) |
`class` 遵循 Vue 的 class 绑定,可接收字符串、数组和对象,并与组件基础类合并;不要使用 React 的 `className`。
默认渲染为 `hr`,带 `role="separator"` 与 `data-orientation`。`orientation` 为 `vertical` 时附加 `aria-orientation="vertical"`。上游 `render` 由 `as-child` 适配。
## 相关组件
[Surface 表面](./surface) · [Card 卡片](./card)
+7 -2
View File
@@ -1,5 +1,10 @@
<script setup lang="ts">
import { Avatar, AvatarImage, AvatarFallback } from "@heroui-vue/components";
import {
Avatar,
AvatarImage,
AvatarFallback,
Separator,
} from "@heroui-vue/components";
import { IconUser } from "@tabler/icons-vue";
const colors = ["accent", "default", "success", "warning", "danger"] as const;
@@ -44,7 +49,7 @@ const variants = [
</div>
</div>
<div class="h-px w-full bg-separator" />
<Separator />
<!-- 变体行 -->
<div
+13
View File
@@ -0,0 +1,13 @@
<script setup lang="ts">
import { Chip } from "@heroui-vue/components";
</script>
<template>
<div class="flex flex-wrap items-center gap-3">
<Chip>默认</Chip>
<Chip color="accent">强调</Chip>
<Chip color="success">成功</Chip>
<Chip color="warning">警告</Chip>
<Chip color="danger">危险</Chip>
</div>
</template>
+23
View File
@@ -0,0 +1,23 @@
<script setup lang="ts">
import { Chip } from "@heroui-vue/components";
</script>
<template>
<div class="flex flex-wrap items-center gap-2">
<Chip
class="rounded-full bg-default-soft px-3 text-default-soft-foreground"
>
草稿
</Chip>
<Chip
class="rounded-full bg-warning-soft px-3 text-warning-soft-foreground"
>
审核中
</Chip>
<Chip
class="rounded-full bg-success-soft px-3 text-success-soft-foreground"
>
已发布
</Chip>
</div>
</template>
+52
View File
@@ -0,0 +1,52 @@
<script setup lang="ts">
import { Chip, ChipLabel } from "@heroui-vue/components";
import {
IconBan,
IconCheck,
IconCircleFilled,
IconInfoCircle,
IconAlertTriangle,
} from "@tabler/icons-vue";
</script>
<template>
<div class="flex flex-col gap-4">
<div class="flex flex-wrap items-center gap-3">
<Chip variant="primary">
<IconCircleFilled :size="6" aria-hidden="true" />
<ChipLabel>默认</ChipLabel>
</Chip>
<Chip color="success" variant="primary">
<IconCircleFilled :size="6" aria-hidden="true" />
<ChipLabel>活跃</ChipLabel>
</Chip>
<Chip color="warning" variant="primary">
<IconCircleFilled :size="6" aria-hidden="true" />
<ChipLabel>待处理</ChipLabel>
</Chip>
<Chip color="danger" variant="primary">
<IconCircleFilled :size="6" aria-hidden="true" />
<ChipLabel>未激活</ChipLabel>
</Chip>
</div>
<div class="flex flex-wrap items-center gap-3">
<Chip>
<IconInfoCircle :size="12" aria-hidden="true" />
<ChipLabel>新功能</ChipLabel>
</Chip>
<Chip color="success">
<IconCheck :size="12" aria-hidden="true" />
<ChipLabel>可用</ChipLabel>
</Chip>
<Chip color="warning">
<IconAlertTriangle :size="12" aria-hidden="true" />
<ChipLabel>测试版</ChipLabel>
</Chip>
<Chip color="danger">
<IconBan :size="12" aria-hidden="true" />
<ChipLabel>已弃用</ChipLabel>
</Chip>
</div>
</div>
</template>
+78
View File
@@ -0,0 +1,78 @@
<script setup lang="ts">
import { Chip, ChipLabel, Separator } from "@heroui-vue/components";
import { IconCircleDashed } from "@tabler/icons-vue";
const sizes = ["lg", "md", "sm"] as const;
const SIZE_LABELS: Record<(typeof sizes)[number], string> = {
lg: "大",
md: "中",
sm: "小",
};
const variants = ["primary", "secondary", "tertiary", "soft"] as const;
const VARIANT_LABELS: Record<(typeof variants)[number], string> = {
primary: "主要",
secondary: "次要",
soft: "柔和",
tertiary: "第三",
};
const colors = ["accent", "default", "success", "warning", "danger"] as const;
const COLOR_LABELS: Record<(typeof colors)[number], string> = {
accent: "强调",
danger: "危险",
default: "默认",
success: "成功",
warning: "警告",
};
</script>
<template>
<div class="flex flex-col gap-8 overflow-x-auto">
<template v-for="(size, index) in sizes" :key="size">
<div class="flex flex-col gap-4">
<h3 class="text-sm font-semibold text-muted">
{{ SIZE_LABELS[size] }}
</h3>
<div class="flex items-center gap-3">
<div class="w-24 shrink-0" />
<div
v-for="color in colors"
:key="color"
class="flex shrink-0 items-center justify-center"
style="width: 130px"
>
<span class="text-xs text-muted">{{ COLOR_LABELS[color] }}</span>
</div>
</div>
<div class="flex flex-col gap-3">
<div
v-for="variant in variants"
:key="variant"
class="flex items-center gap-3"
>
<div class="w-24 shrink-0 text-sm text-muted">
{{ VARIANT_LABELS[variant] }}
</div>
<div
v-for="color in colors"
:key="color"
class="flex shrink-0 items-center justify-center"
style="width: 130px"
>
<Chip :color="color" :size="size" :variant="variant">
<IconCircleDashed aria-hidden="true" />
<ChipLabel>标签</ChipLabel>
<IconCircleDashed aria-hidden="true" />
</Chip>
</div>
</div>
</div>
</div>
<Separator v-if="index < sizes.length - 1" />
</template>
</div>
</template>
+35
View File
@@ -0,0 +1,35 @@
<script setup lang="ts">
import { Chip, ChipLabel } from "@heroui-vue/components";
import {
IconChevronDown,
IconCircleCheckFilled,
IconCircleFilled,
IconClock,
IconX,
} from "@tabler/icons-vue";
</script>
<template>
<div class="flex flex-wrap items-center gap-3">
<Chip>
<IconCircleFilled :size="6" aria-hidden="true" />
<ChipLabel>信息</ChipLabel>
</Chip>
<Chip color="success">
<IconCircleCheckFilled :size="12" aria-hidden="true" />
<ChipLabel>已完成</ChipLabel>
</Chip>
<Chip color="warning">
<IconClock :size="12" aria-hidden="true" />
<ChipLabel>待处理</ChipLabel>
</Chip>
<Chip color="danger">
<IconX :size="12" aria-hidden="true" />
<ChipLabel>失败</ChipLabel>
</Chip>
<Chip color="accent">
<ChipLabel>标签</ChipLabel>
<IconChevronDown :size="12" aria-hidden="true" />
</Chip>
</div>
</template>
+24
View File
@@ -0,0 +1,24 @@
<script setup lang="ts">
import { Kbd, KbdAbbr, KbdContent } from "@heroui-vue/components";
</script>
<template>
<div class="flex items-center gap-4">
<Kbd>
<KbdAbbr key-value="command" />
<KbdContent>K</KbdContent>
</Kbd>
<Kbd>
<KbdAbbr key-value="shift" />
<KbdContent>P</KbdContent>
</Kbd>
<Kbd>
<KbdAbbr key-value="ctrl" />
<KbdContent>C</KbdContent>
</Kbd>
<Kbd>
<KbdAbbr key-value="option" />
<KbdContent>D</KbdContent>
</Kbd>
</div>
</template>
+16
View File
@@ -0,0 +1,16 @@
<script setup lang="ts">
import { Kbd, KbdAbbr, KbdContent } from "@heroui-vue/components";
</script>
<template>
<div class="flex items-center gap-3">
<Kbd class="rounded-lg bg-accent-soft px-2.5 text-accent-soft-foreground">
<KbdAbbr key-value="command" />
<KbdContent>K</KbdContent>
</Kbd>
<Kbd class="rounded-lg bg-default px-2.5 text-muted">
<KbdAbbr key-value="shift" />
<KbdContent>P</KbdContent>
</Kbd>
</div>
</template>
+42
View File
@@ -0,0 +1,42 @@
<script setup lang="ts">
import { Kbd, KbdAbbr, KbdContent } from "@heroui-vue/components";
</script>
<template>
<div class="space-y-4">
<p class="text-sm">
按
<Kbd>
<KbdContent>Esc</KbdContent>
</Kbd>
关闭对话框。
</p>
<p class="text-sm">
使用
<Kbd>
<KbdAbbr key-value="command" />
<KbdContent>K</KbdContent>
</Kbd>
打开命令面板。
</p>
<p class="text-sm">
使用
<Kbd>
<KbdAbbr key-value="up" />
</Kbd>
和
<Kbd>
<KbdAbbr key-value="down" />
</Kbd>
方向键进行导航。
</p>
<p class="text-sm">
使用
<Kbd>
<KbdAbbr key-value="command" />
<KbdContent>S</KbdContent>
</Kbd>
定期保存你的工作。
</p>
</div>
</template>
@@ -0,0 +1,41 @@
<script setup lang="ts">
import { Kbd, KbdAbbr, KbdContent } from "@heroui-vue/components";
</script>
<template>
<div class="space-y-3">
<div class="rounded-lg bg-surface p-4">
<h4 class="mb-2 text-sm font-semibold">快捷操作</h4>
<ul class="space-y-2 text-sm">
<li>
• 打开搜索:
<Kbd>
<KbdAbbr key-value="command" />
<KbdContent>K</KbdContent>
</Kbd>
</li>
<li>
• 切换侧边栏:
<Kbd>
<KbdAbbr key-value="command" />
<KbdContent>B</KbdContent>
</Kbd>
</li>
<li>
• 新建文件:
<Kbd>
<KbdAbbr key-value="command" />
<KbdContent>N</KbdContent>
</Kbd>
</li>
<li>
• 快速保存:
<Kbd>
<KbdAbbr key-value="command" />
<KbdContent>S</KbdContent>
</Kbd>
</li>
</ul>
</div>
</div>
</template>
+42
View File
@@ -0,0 +1,42 @@
<script setup lang="ts">
import { Kbd, KbdAbbr } from "@heroui-vue/components";
</script>
<template>
<div class="flex flex-col gap-4">
<div class="flex items-center gap-2">
<span class="text-sm text-muted">方向键:</span>
<div class="flex items-center gap-2">
<Kbd>
<KbdAbbr key-value="up" />
</Kbd>
<Kbd>
<KbdAbbr key-value="down" />
</Kbd>
<Kbd>
<KbdAbbr key-value="left" />
</Kbd>
<Kbd>
<KbdAbbr key-value="right" />
</Kbd>
</div>
</div>
<div class="flex items-center gap-2">
<span class="text-sm text-muted">页面导航:</span>
<div class="flex items-center gap-2">
<Kbd>
<KbdAbbr key-value="pageup" />
</Kbd>
<Kbd>
<KbdAbbr key-value="pagedown" />
</Kbd>
<Kbd>
<KbdAbbr key-value="home" />
</Kbd>
<Kbd>
<KbdAbbr key-value="end" />
</Kbd>
</div>
</div>
</div>
</template>
+38
View File
@@ -0,0 +1,38 @@
<script setup lang="ts">
import { Kbd, KbdAbbr } from "@heroui-vue/components";
</script>
<template>
<div class="space-y-3">
<p class="text-sm">
按
<Kbd>
<KbdAbbr key-value="enter" />
</Kbd>
确认,或按
<Kbd>
<KbdAbbr key-value="escape" />
</Kbd>
取消。
</p>
<p class="text-sm">
使用
<Kbd>
<KbdAbbr key-value="tab" />
</Kbd>
在表单字段间切换,使用
<Kbd>
<KbdAbbr key-value="shift" />
<KbdAbbr key-value="tab" />
</Kbd>
返回上一项。
</p>
<p class="text-sm">
按住
<Kbd>
<KbdAbbr key-value="space" />
</Kbd>
可临时启用平移模式。
</p>
</div>
</template>
+65
View File
@@ -0,0 +1,65 @@
<script setup lang="ts">
import { Kbd, KbdAbbr, KbdContent } from "@heroui-vue/components";
</script>
<template>
<div class="flex flex-col gap-4">
<div class="flex items-center gap-2">
<span>复制:</span>
<Kbd>
<KbdAbbr key-value="command" />
<KbdContent>C</KbdContent>
</Kbd>
<Kbd variant="light">
<KbdAbbr key-value="command" />
<KbdContent>C</KbdContent>
</Kbd>
</div>
<div class="flex items-center gap-2">
<span>粘贴:</span>
<Kbd>
<KbdAbbr key-value="command" />
<KbdContent>V</KbdContent>
</Kbd>
<Kbd variant="light">
<KbdAbbr key-value="command" />
<KbdContent>V</KbdContent>
</Kbd>
</div>
<div class="flex items-center gap-2">
<span>剪切:</span>
<Kbd>
<KbdAbbr key-value="command" />
<KbdContent>X</KbdContent>
</Kbd>
<Kbd variant="light">
<KbdAbbr key-value="command" />
<KbdContent>X</KbdContent>
</Kbd>
</div>
<div class="flex items-center gap-2">
<span>撤销:</span>
<Kbd>
<KbdAbbr key-value="command" />
<KbdContent>Z</KbdContent>
</Kbd>
<Kbd variant="light">
<KbdAbbr key-value="command" />
<KbdContent>Z</KbdContent>
</Kbd>
</div>
<div class="flex items-center gap-2">
<span>重做:</span>
<Kbd>
<KbdAbbr key-value="command" />
<KbdAbbr key-value="shift" />
<KbdContent>Z</KbdContent>
</Kbd>
<Kbd variant="light">
<KbdAbbr key-value="command" />
<KbdAbbr key-value="shift" />
<KbdContent>Z</KbdContent>
</Kbd>
</div>
</div>
</template>
+22
View File
@@ -0,0 +1,22 @@
<script setup lang="ts">
import { Separator } from "@heroui-vue/components";
</script>
<template>
<div class="max-w-md">
<div class="space-y-1">
<h4 class="text-medium font-medium">HeroUI v3 组件</h4>
<p class="text-small text-default-400">
美观、快速、现代的 React UI 库。
</p>
</div>
<Separator class="my-4" />
<div class="text-small flex h-5 items-center space-x-4">
<div>博客</div>
<Separator orientation="vertical" />
<div>文档</div>
<Separator orientation="vertical" />
<div>源码</div>
</div>
</div>
</template>
@@ -0,0 +1,17 @@
<script setup lang="ts">
import { Separator } from "@heroui-vue/components";
</script>
<template>
<div class="max-w-xs space-y-4">
<p class="text-sm font-medium text-foreground">账户设置</p>
<Separator class="bg-separator-secondary" />
<div class="flex items-center gap-3 text-sm text-muted">
<span>个人资料</span>
<Separator class="h-4 bg-separator" orientation="vertical" />
<span>账单</span>
<Separator class="h-4 bg-separator" orientation="vertical" />
<span>安全</span>
</div>
</div>
</template>
@@ -0,0 +1,28 @@
<script setup lang="ts">
import { Separator } from "@heroui-vue/components";
</script>
<template>
<div class="max-w-md">
<div class="space-y-1">
<h4 class="text-medium font-medium">HeroUI v3 组件</h4>
<p class="text-small text-default-400">
美观、快速、现代的 React UI 库。
</p>
</div>
<Separator class="my-4" as-child>
<div data-custom="foo"></div>
</Separator>
<div class="text-small flex h-5 items-center space-x-4">
<div>博客</div>
<Separator orientation="vertical" as-child>
<div data-custom="foo"></div>
</Separator>
<div>文档</div>
<Separator orientation="vertical" as-child>
<div data-custom="foo"></div>
</Separator>
<div>源码</div>
</div>
</div>
</template>
+14
View File
@@ -0,0 +1,14 @@
<script setup lang="ts">
import { Separator } from "@heroui-vue/components";
</script>
<template>
<div class="flex max-w-md flex-col items-center gap-3">
<div>默认变体</div>
<Separator variant="default" />
<div>次要变体</div>
<Separator variant="secondary" />
<div>第三变体</div>
<Separator variant="tertiary" />
</div>
</template>
+13
View File
@@ -0,0 +1,13 @@
<script setup lang="ts">
import { Separator } from "@heroui-vue/components";
</script>
<template>
<div class="text-small flex h-5 items-center space-x-4">
<div>博客</div>
<Separator orientation="vertical" />
<div>文档</div>
<Separator orientation="vertical" />
<div>源码</div>
</div>
</template>
@@ -0,0 +1,39 @@
<script setup lang="ts">
import { Separator } from "@heroui-vue/components";
const items = [
{
iconUrl:
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/3dicons/bell-small.png",
subtitle: "接收账户活动更新",
title: "设置通知",
},
{
iconUrl:
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/3dicons/compass-small.png",
subtitle: "将浏览器连接到你的账户",
title: "设置浏览器扩展",
},
{
iconUrl:
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/3dicons/mint-collective-small.png",
subtitle: "创建你的第一件收藏品",
title: "铸造收藏品",
},
];
</script>
<template>
<div class="max-w-md space-y-4">
<div v-for="(item, index) in items" :key="item.title">
<div class="flex items-center gap-3">
<img :alt="item.title" class="size-12" :src="item.iconUrl" />
<div class="flex-1 space-y-0">
<h4 class="text-small font-medium">{{ item.title }}</h4>
<p class="text-sm text-muted">{{ item.subtitle }}</p>
</div>
</div>
<Separator v-if="index < items.length - 1" class="my-4" />
</div>
</div>
</template>
@@ -0,0 +1,51 @@
<script setup lang="ts">
import { Separator, Surface } from "@heroui-vue/components";
</script>
<template>
<div class="flex flex-col gap-8">
<div class="flex flex-col gap-2">
<Surface
class="flex min-w-[320px] flex-col gap-3 rounded-3xl p-6"
variant="default"
>
<h3 class="text-base font-semibold text-foreground">默认表面</h3>
<Separator />
<p class="text-sm text-muted">表面内容</p>
</Surface>
</div>
<div class="flex flex-col gap-2">
<Surface
class="flex min-w-[320px] flex-col gap-3 rounded-3xl p-6"
variant="secondary"
>
<h3 class="text-base font-semibold text-foreground">次要表面</h3>
<Separator variant="secondary" />
<p class="text-sm text-muted">表面内容</p>
</Surface>
</div>
<div class="flex flex-col gap-2">
<Surface
class="flex min-w-[320px] flex-col gap-3 rounded-3xl p-6"
variant="tertiary"
>
<h3 class="text-base font-semibold text-foreground">第三表面</h3>
<Separator variant="tertiary" />
<p class="text-sm text-muted">表面内容</p>
</Surface>
</div>
<div class="flex flex-col gap-2">
<Surface
class="flex min-w-[320px] flex-col gap-3 rounded-3xl border p-6"
variant="transparent"
>
<h3 class="text-base font-semibold text-foreground">透明表面</h3>
<Separator />
<p class="text-sm text-muted">表面内容</p>
</Surface>
</div>
</div>
</template>