Icon
图标用于展示内置图标库中的图形符号,可与文本或其他组件组合使用。
使用
ts
import { NxIcon } from "@pc-nexus/angular";ts
import { NxIcon } from "@pc-nexus/react";属性
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
name | string | Y | 图标名称,仅支持内置图标库中的名称 |
appearance | 'outline' | 'fill' | 图标外观,默认 outline | |
size | 'small' | 'medium' | 'large' | 图标大小,默认 medium | |
color | 'default' | 'primary' | 'success' | 'info' | 'warning' | 'danger' | 语义色,默认 default | |
rotate | number | 旋转角度(度),如 90、180 |
示例
Basic
通过 name 指定图标。name 只支持内置图标库中的名称,暂不支持应用本地资源图标与远程图标。
Appearance
通过 appearance 设置图标外观,取值可以为 'outline' | 'fill'。fill 会在图标名后追加 -fill,因此只有提供了 fill 变体的图标可用;默认为 outline。
Size
通过 size 设置图标大小,取值可以为 'small' | 'medium' | 'large'。
Color
通过 color 设置语义色,取值可以为 'default' | 'primary' | 'success' | 'info' | 'warning' | 'danger'。不支持任意色值;需要自定义色时用 className。
Rotate
通过 rotate 设置旋转角度(单位为度)。