Skip to content

Icon 图标

KKDUI 使用独立 SVG Vue 组件承载图标。图标通过 kkdui/icons 按需导入,并使用 currentColor 继承文本或组件颜色。

基础用法

使用 KIcon 统一控制尺寸、颜色和无障碍标签。

vue
<script setup>
import { KIcon } from "kkdui";
import { SearchIcon } from "kkdui/icons";
</script>

<template>
  <KIcon :size="20" color="#257360" label="搜索">
    <SearchIcon />
  </KIcon>
</template>

图标集合

点击图标可以复制对应的导入代码。

KIcon API

Props

属性说明类型默认值
size图标宽高,数字按像素处理string | number"1em"
color图标颜色string继承文本颜色
label有语义图标的无障碍说明文字string

Slots

插槽说明
defaultSVG Vue 图标组件

装饰性图标不传 labelKIcon 会自动设置 aria-hidden="true";表达独立含义时应提供明确的 label

基于 MIT 许可发布