IconFont 图标

代码演示

基础用法

import { IconFont } from 'tuya-panel-kit'
<IconFont name="arrow" />
<IconFont name="backAndroid" />
<IconFont name="backIos" />
<IconFont name="celsius" />

图标颜色

import { IconFont } from 'tuya-panel-kit'
<IconFont color="#F84803" name="arrow" />
<IconFont color="#F84803" name="backAndroid" />
<IconFont color="#F84803" name="backIos" />
<IconFont color="#F84803" name="celsius" />

图标大小

import { IconFont, Utils } from 'tuya-panel-kit';
const { convertX: cx } = Utils.RatioUtils;
<IconFont color="#F84803" size={cx(14)} name="arrow" />
<IconFont color="#F84803" size={cx(24)} name="backAndroid" />
<IconFont color="#F84803" size={cx(34)} name="backIos" />
<IconFont color="#F84803" size={cx(44)} name="celsius" />

API

属性名描述类型默认值
viewBoxSvg 视窗
string
'0 0 1024 1024'
useART是否使用 ART 形式
boolean
false
ascent上升
number
896
descent下降
number
-128
unitsPerEm单位制
number
1024
x图标起始横坐标
number
0
y图标起始纵坐标
number
0
scaleX图标宽度放大倍数
number
null
scaleY图标高度放大倍数
number
null
scale图标的放大倍数
number
1.0
spaceOffset多个实体渲染时, 空白间隔偏移量, 可以让渲染更紧凑些
number
0
style容器样式null
color图标颜色,fill 和 stroke 的缩写
any
"#000"
sizeIcon 尺寸,width / height 的缩写
number
12
hFlip水平翻转
boolean
false
vFlip垂直翻转
boolean
false
name图标id,会从组件库默认图标里取,优先级小于 dundefined
width图标宽度,默认为 size 的值
number
12
height图标高度,默认为 size 的值
number
12
fill填充色,若传递该值 color 会被忽略
string
null
stroke描边色
string
null
strokeWidth描边宽度
number
1
strokeJoin连接处形状
'round' | 'miter' | 'bevel'
"round"
strokeCap首尾端形状
'round' | 'butt' | 'square'
"round"
strokeDash实虚线,数组内第一个元素为一段虚线的长度,第二个为间距
number[]
[0, 0]
d图标 path,svg 的 path
string
''
opacity路径透明度
string | number
null

FAQ

  1. 更多资料?

react-native-svg/Path

tuya14:08