Skip to content

Icon 图标

Aurora Plus 提供可按需导入的图标组件,并支持调整尺寸、颜色和描边宽度。AuIcon 用于统一图标的尺寸、颜色和无障碍属性。

基础用法

aurora-plus 导入需要的图标组件:

vue
<script setup>
import { IconHome, IconSearch } from 'aurora-plus';
</script>

<template>
  <IconHome />
  <IconSearch size="20" color="#3478f6" />
</template>
常用图标

图标组件可以直接使用,也可以交给 AuIcon 统一控制尺寸、颜色和描边。

IconHome
IconSearch
IconSettings
IconBell
IconBrandGithub
IconCheck
IconX
IconChevronRight
IconCode
IconMenu2
IconStar
IconTrash
IconLoader2
IconHeartFilled
vue

图标集合

下方目录收录当前版本的全部图标。可以按功能分类、样式或英文组件名筛选,点击图标即可复制组件名。

在 Aurora Plus 组件中使用

接受图标的 Aurora Plus 组件统一接收 Vue 图标组件本身,而不是字符串名称:

vue
<script setup>
import { AuButton, AuDropdown, IconDownload, IconSettings } from 'aurora-plus';

const menuItems = [
  { id: 'download', label: '下载', icon: IconDownload },
  { id: 'settings', label: '设置', icon: IconSettings },
];
</script>

<template>
  <AuButton :icon="IconDownload">下载</AuButton>
  <AuDropdown :items="menuItems" />
</template>

AuButtonAuDropdownAuContextMenuicon 字段都遵循同一约定,并支持描边和填充图标变体。

AuIcon API

AuIcon 适合需要统一对齐、尺寸或无障碍属性的场景:

vue
<script setup>
import { AuIcon, IconHeart } from 'aurora-plus';
</script>

<template>
  <AuIcon
    :icon="IconHeart"
    size="28"
    color="#e5484d"
    :stroke-width="1.5"
    aria-label="收藏"
  />
</template>

Attributes

属性说明类型默认值
icon图标组件Componentnull
color图标颜色string''
size根节点宽高及字号;数字会转换为 pxstring / number''
strokeWidth图标描边宽度number2
ariaLabel图标的无障碍名称;为空时设置 aria-hidden="true"string''

其他 HTML 属性会透传到 .au-icon 根节点。装饰性图标保持默认的隐藏语义;表达操作含义时请提供 aria-label,或在按钮上提供可见文本。

图标变体与查找

图标组件名以 Icon 开头,例如 IconHeartIconHeartFilled。完整图标清单、预览和组件名可在本页的图标集合中查看。

Aurora Plus · Vue 3 Component Library