Skip to content

RIcon 图表

快捷使用 svg 作为图标。

使用流程

提示

如果需要让 svg 继承 color 颜色值,需要注意 svg 文件的 fill 属性是否为 currentColor

  • 引入图标至 src/icons 文件夹下
  • 确保文件名为 demo.svg 格式
  • 使用 RIcon 组件引入图标
tsx
import { RIcon } from '@/components'

const Demo = () => {
  return <RIcon icon="demo" />
}

props

名称类型默认值说明
colorstringcurrentColor图标颜色
prefixstringicon图标前缀
namestring-图标名称,名称为图标的文件名,必填
sizestring | number14图标尺寸,同时设置宽高
widthstring | number0图标宽度
heightstring | number0图标高度
depthnumber1图标颜色深度,也就是透明度
cursorstringdefault鼠标样式

Released under the MIT License.