# kui-icons **Repository Path**: chuchur/kui-icons ## Basic Information - **Project Name**: kui-icons - **Description**: kui 组件库的图标库!! - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2020-09-16 - **Last Updated**: 2026-03-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Icon 图标 一起422个图标, 部分图标引用了 `ionicons` ,可以在 `kui-vue` 和 `react-kui` 中使用。 使用图标组件,你需要安装 `kui-icons` 图标组件包: ```sh npm install --save kui-icons ``` 在 Vue 中使用 ```vue import { Icon } from 'kui-vue' import { Heart } from 'kui-icons' ``` ## 使用Sprite模式 ```vue import sprite from 'kui-icons/dist/sprite.svg' ``` ## 辅助函数 ### resizeSVG 合并SVG 所有的Path 元素,包括 `path` , `rect` , `circle`, `ellipse`, `polygon`, `polyline`, `line` ```js import { resizeSVG } from "kui-icons/utils/parse.js"; let svgContent = ` `; // 合并所有path,并缩放viewbox 为300*300 const svg = resizeSVG(svgContent, true, 300); ``` out put: ```html ``` ### generate 把多个SVG文件合并成一个文件,生成`sprite.svg`文件,自动合并所有path, 自动提取`styles`, 自动统一`viewBox` ```js import fs from "fs"; import { generate } from "kui-icons/utils/pathify.js"; // 读取source目录所有的 svg 文件 const { spriteList } = generate("./source/*.svg"); // out put svg sprite fs.writeFileSync( "./dist/sprite.svg", `${spriteList}`, ); ```