图标
UIKit 内置一套 SVG 图标体系,由 EmIcon 组件统一渲染。所有图标集中在 packages/uikit-core/src/assets/icons-v2/,命名与设计师 svg 文件名 1:1。面性图标放在 icons-v2/filled/,name 带 filled/ 前缀,目前主要用于在线状态等需要实心图形的场景。旧库 assets/icons/ 已整目录删除,V2 是唯一图标库。
不再依赖外部图标库兜底。
图标体系说明
- 渲染组件:
EmIcon(全局注册为<Icon />)。图标以 inline SVG 方式渲染,不依赖图片请求。 - name 规则:
name与资源目录下的<路径>.svg文件一一对应。例如chevron/down对应icons-v2/chevron/down.svg,filled/circle/empty对应icons-v2/filled/circle/empty.svg。构建时通过import.meta.glob自动注册,新增文件即生效,无需手工登记。 - 着色:图标统一使用
currentColor(填充式 pathfill="currentColor",描边式 pathstroke="currentColor"),颜色跟随 CSScolor,天然适配主题体系;也可通过colorprop 显式指定。SVG 源文件中禁止写死fill="black"/stroke="black",否则深色模式下图标不会随主题反色。 - 尺寸:通过
sizeprop 指定(单位 px,默认 20),SVG 原始viewBox会被保留,不会被裁切。
<template>
<!-- 基础用法 -->
<Icon name="chevron/right" />
<!-- 指定尺寸与颜色 -->
<Icon name="trash" :size="18" color="var(--uikit-color-danger)" />
<!-- 语义色 -->
<Icon name="circle/bang" :size="16" type="danger" />
<!-- 面性图标(在线状态示例) -->
<Icon name="filled/circle/empty" :size="10" color="#6CE191" />
</template>线性图标常见顶层分类包括:arrow(箭头)、audio-video(音视频)、bell(通知)、bubble(气泡)、camera(相机)、check(勾选)、chevron(折角箭头)、circle(圆圈状态)、console(控制台)、file(文件类型)、folder(文件夹)、mic(麦克风)、person(人员)、pin(置顶)、rect(矩形容器内的图形)、search(搜索)、shield(权限)、speaker(扬声器)、trash(删除)、xmark(关闭)等。
图标一览
下方展示 UIKit 当前内置的全部 V2 SVG 图标,按目录分类排列,点击即可复制名称。
线性图标(V2) (287)
archive (1)
archive点击复制arrow (13)
arrow/down点击复制arrow/down_line点击复制arrow/down_tray点击复制arrow/left点击复制arrow/lft_uturn点击复制arrow/rgt_uturn点击复制arrow/rgt_uturn_tray点击复制arrow/right点击复制arrow/turn_left点击复制arrow/turn_right点击复制arrow/up点击复制arrow/up_line点击复制arrow/up_tray点击复制at (1)
at点击复制bell (2)
bell点击复制bell/slash点击复制board (1)
board点击复制board-1 (1)
board-1点击复制bubble (8)
bubble/circle点击复制bubble/empty点击复制bubble/hashtag点击复制bubble/hora点击复制bubble/rect点击复制bubble/rect/2点击复制bubble/rect/empty点击复制bubble/slash点击复制camera (1)
camera点击复制check (2)
check/double点击复制check/single点击复制chevron (6)
chevron/down点击复制chevron/left-right点击复制chevron/left点击复制chevron/right点击复制chevron/up-down点击复制chevron/up点击复制circle (18)
circle/3bars点击复制circle/bang点击复制circle/candle点击复制circle/checked点击复制circle/clock点击复制circle/ellipsis点击复制circle/empty-1点击复制circle/empty点击复制circle/face点击复制circle/fill点击复制circle/img点击复制circle/minus点击复制circle/person点击复制circle/plus点击复制circle/quote点击复制circle/slash点击复制circle/waves点击复制circle/xmark点击复制console (1)
console点击复制crown (1)
crown点击复制dict (1)
dict点击复制doc (1)
doc点击复制dspntd (1)
dspntd点击复制envelope (1)
envelope点击复制envelope_2 (1)
envelope_2点击复制eye (2)
eye点击复制eye/slash点击复制file (12)
file点击复制file/archive点击复制file/audio点击复制file/doc点击复制file/empty点击复制file/img点击复制file/md点击复制file/pdf点击复制file/ppt点击复制file/video点击复制file/xls点击复制file/xmark点击复制filled (100)
filled/archive点击复制filled/at点击复制filled/bell点击复制filled/bell/slash点击复制filled/bubble/circle点击复制filled/bubble/empty点击复制filled/bubble/hora点击复制filled/bubble/rect点击复制filled/bubble/rect/empty点击复制filled/bubble/slash点击复制filled/camera点击复制filled/circle/bang点击复制filled/circle/candle点击复制filled/circle/checked点击复制filled/circle/clock点击复制filled/circle/ellipsis点击复制filled/circle/empty点击复制filled/circle/equals点击复制filled/circle/face点击复制filled/circle/img点击复制filled/circle/minus点击复制filled/circle/person点击复制filled/circle/plus点击复制filled/circle/quote点击复制filled/circle/slash点击复制filled/circle/star点击复制filled/circle/xmark点击复制filled/console点击复制filled/crown点击复制filled/doc点击复制filled/eye点击复制filled/eye/slash点击复制filled/file/audio点击复制filled/file/empty点击复制filled/file/img点击复制filled/file/pdf点击复制filled/file/ppt点击复制filled/file/video点击复制filled/file/xls点击复制filled/flower点击复制filled/folder点击复制filled/globe点击复制filled/loc点击复制filled/lock/closed点击复制filled/lock/dot点击复制filled/lock/open点击复制filled/mic点击复制filled/mic/slash点击复制filled/nut点击复制filled/person/check点击复制filled/person/double点击复制filled/person/list点击复制filled/person/minus点击复制filled/person/plus点击复制filled/person/single点击复制filled/person/xmark点击复制filled/phone点击复制filled/pin点击复制filled/pin/fill点击复制filled/pin/slash点击复制filled/plane点击复制filled/rect/candle点击复制filled/rect/checked点击复制filled/rect/empty点击复制filled/rect/fill-1点击复制filled/rect/fill点击复制filled/rect/hanzi点击复制filled/rect/hanzi/slash点击复制filled/rect/hanzinalpha点击复制filled/rect/hanzinalpha/slash点击复制filled/rect/idphoto点击复制filled/rect/img点击复制filled/rect/lftarrow点击复制filled/rect/minus-1点击复制filled/rect/minus点击复制filled/rect/pencil点击复制filled/rect/plane点击复制filled/rect/rgtarrow点击复制filled/rect/triangle点击复制filled/rect/xmark点击复制filled/rect_notched/pen点击复制filled/rects点击复制filled/search点击复制filled/search/minus点击复制filled/search/plus点击复制filled/search/xmark点击复制filled/shield点击复制filled/shield/checked点击复制filled/shield/person点击复制filled/shield/slash点击复制filled/shield/xmark点击复制filled/speaker/wave点击复制filled/speaker/wave_1点击复制filled/speaker/wave_2点击复制filled/speaker/xmark点击复制filled/trash点击复制filled/triangle点击复制filled/triangle/exclamation点击复制filled/video点击复制filled/video/slash点击复制flower (1)
flower点击复制folder (2)
folder点击复制folder/open点击复制globe (1)
globe点击复制hamburger (1)
hamburger点击复制horizontal (1)
horizontal点击复制items_check (1)
items_check点击复制knife (1)
knife点击复制lines (2)
lines点击复制lines/arrow-right_3bars点击复制list (2)
list点击复制list/bullet点击复制loading (4)
loading/2clrs点击复制loading/arc/big点击复制loading/arc/normal点击复制loading/arc/small点击复制loc (1)
loc点击复制lock (3)
lock/closed点击复制lock/dot点击复制lock/open点击复制mic (4)
mic点击复制mic/dot点击复制mic/fill点击复制mic/slash点击复制minus (1)
minus点击复制nut (1)
nut点击复制paperclip (1)
paperclip点击复制person (11)
person/arrows点击复制person/ban点击复制person/card点击复制person/check点击复制person/clock点击复制person/double点击复制person/list点击复制person/minus点击复制person/plus点击复制person/single点击复制person/xmark点击复制phone (1)
phone点击复制pin (3)
pin点击复制pin/fill点击复制pin/slash点击复制plane (1)
plane点击复制plus (1)
plus点击复制polyline (3)
polyline/singularity点击复制polyline/spread点击复制polyline/topright点击复制quote (4)
quote/left点击复制quote/left_down点击复制quote/right点击复制quote/right_down点击复制rect (26)
rect点击复制rect/3bars点击复制rect/candle点击复制rect/checked点击复制rect/equals点击复制rect/fill-1点击复制rect/fill点击复制rect/hanzi点击复制rect/hanzi/slash点击复制rect/hanzinalpha点击复制rect/hanzinalpha/slash点击复制rect/idphoto点击复制rect/img点击复制rect/keyboard点击复制rect/lftarrow点击复制rect/minus-1点击复制rect/minus点击复制rect/narrow-return点击复制rect/pencil点击复制rect/person-clock点击复制rect/plane点击复制rect/rgtarrow点击复制rect/star点击复制rect/triangle点击复制rect/waves点击复制rect/xmark点击复制rect_notched (1)
rect_notched/pen点击复制rects (1)
rects点击复制ringarrow (2)
ringarrow/ccw点击复制ringarrow/cw点击复制search (4)
search点击复制search/minus点击复制search/plus点击复制search/xmark点击复制shield (5)
shield点击复制shield/checked点击复制shield/person点击复制shield/slash点击复制shield/xmark点击复制signal (1)
signal点击复制speaker (4)
speaker/wave点击复制speaker/wave_1点击复制speaker/wave_2点击复制speaker/xmark点击复制status (5)
status/3pm点击复制status/check点击复制status/equals点击复制status/minus点击复制status/star点击复制trash (1)
trash点击复制triangle (2)
triangle点击复制triangle/exclamation点击复制unity (1)
unity点击复制vertical (1)
vertical点击复制video (2)
video点击复制video/slash点击复制voice_motion_01 (1)
voice_motion_01点击复制voice_motion_02 (1)
voice_motion_02点击复制voice_motion_03 (1)
voice_motion_03点击复制xmark (2)
xmark/bold点击复制xmark/light点击复制面性图标(Filled) (100)
filled (100)
filled/archive点击复制filled/at点击复制filled/bell点击复制filled/bell/slash点击复制filled/bubble/circle点击复制filled/bubble/empty点击复制filled/bubble/hora点击复制filled/bubble/rect点击复制filled/bubble/rect/empty点击复制filled/bubble/slash点击复制filled/camera点击复制filled/circle/bang点击复制filled/circle/candle点击复制filled/circle/checked点击复制filled/circle/clock点击复制filled/circle/ellipsis点击复制filled/circle/empty点击复制filled/circle/equals点击复制filled/circle/face点击复制filled/circle/img点击复制filled/circle/minus点击复制filled/circle/person点击复制filled/circle/plus点击复制filled/circle/quote点击复制filled/circle/slash点击复制filled/circle/star点击复制filled/circle/xmark点击复制filled/console点击复制filled/crown点击复制filled/doc点击复制filled/eye点击复制filled/eye/slash点击复制filled/file/audio点击复制filled/file/empty点击复制filled/file/img点击复制filled/file/pdf点击复制filled/file/ppt点击复制filled/file/video点击复制filled/file/xls点击复制filled/flower点击复制filled/folder点击复制filled/globe点击复制filled/loc点击复制filled/lock/closed点击复制filled/lock/dot点击复制filled/lock/open点击复制filled/mic点击复制filled/mic/slash点击复制filled/nut点击复制filled/person/check点击复制filled/person/double点击复制filled/person/list点击复制filled/person/minus点击复制filled/person/plus点击复制filled/person/single点击复制filled/person/xmark点击复制filled/phone点击复制filled/pin点击复制filled/pin/fill点击复制filled/pin/slash点击复制filled/plane点击复制filled/rect/candle点击复制filled/rect/checked点击复制filled/rect/empty点击复制filled/rect/fill-1点击复制filled/rect/fill点击复制filled/rect/hanzi点击复制filled/rect/hanzi/slash点击复制filled/rect/hanzinalpha点击复制filled/rect/hanzinalpha/slash点击复制filled/rect/idphoto点击复制filled/rect/img点击复制filled/rect/lftarrow点击复制filled/rect/minus-1点击复制filled/rect/minus点击复制filled/rect/pencil点击复制filled/rect/plane点击复制filled/rect/rgtarrow点击复制filled/rect/triangle点击复制filled/rect/xmark点击复制filled/rect_notched/pen点击复制filled/rects点击复制filled/search点击复制filled/search/minus点击复制filled/search/plus点击复制filled/search/xmark点击复制filled/shield点击复制filled/shield/checked点击复制filled/shield/person点击复制filled/shield/slash点击复制filled/shield/xmark点击复制filled/speaker/wave点击复制filled/speaker/wave_1点击复制filled/speaker/wave_2点击复制filled/speaker/xmark点击复制filled/trash点击复制filled/triangle点击复制filled/triangle/exclamation点击复制filled/video点击复制filled/video/slash点击复制业务图标映射
消息状态
己方消息发送状态使用如下图标:
| 状态 | 常量 | 默认图标 | 说明 |
|---|---|---|---|
| 发送中 | MESSAGE_STATUS.SENDING | loading/arc/normal | 旋转 loading |
| 已发送 | MESSAGE_STATUS.SENT | circle/empty | 空心圆 |
| 已送达 | MESSAGE_STATUS.DELIVERED | circle/empty | 空心圆 |
| 已读 | MESSAGE_STATUS.READ | circle/checked | 圆圈内对勾 |
| 发送失败 | MESSAGE_STATUS.FAILED | circle/bang | 圆圈内感叹号,可点击重发 |
PC 端发送失败图标 hover 时会放大 1.2 倍并切换为 ringarrow/cw(重发箭头);H5 直接点击感叹号触发重发。颜色上失败状态使用 --uikit-danger-color,已读状态使用 --uikit-primary-color,其余跟随 --uikit-text-secondary。
群聊已读回执激活时,状态区域会切换为「已读人数圆圈」:全部已读时显示 check/double 图标,否则显示已读人数数字。
在线状态
PresenceSelector / PresenceAvatar 使用 filled/circle/* 面性 SVG 图标,颜色与多端常量对应:
| 状态 | 常量值 | 图标 | 颜色变量 | 默认色 |
|---|---|---|---|---|
| 在线 | Online | filled/circle/empty | --uikit-presence-online-color | #6CE191 |
| 离线 | Offline | filled/circle/empty | --uikit-presence-offline-color | #454545 |
| 离开 | Away | filled/circle/clock | --uikit-presence-away-color | #B9BBC5 |
| 忙碌 | Busy | filled/circle/equals | --uikit-presence-busy-color | #ED7587 |
| 勿扰 | Do Not Disturb | filled/circle/minus | --uikit-presence-dnd-color | #EE798C |
| 自定义 | Custom | filled/circle/star | --uikit-presence-custom-color | #F3C850 |
在线状态常量发布时须与多端保持一致:
Online、Offline、Away、Busy、Do Not Disturb、Custom。
图标设计规范
为保持图标库视觉一致,新增或替换 SVG 时请遵循以下规范:
| 维度 | 规范 | 说明 |
|---|---|---|
| 画布 | 24×24 viewBox | 统一画布尺寸,保证不同图标在相同 size 下视觉权重一致 |
| 描边 | 1.5px ~ 2px | 线性图标统一描边粗细,避免部分图标过细或过粗 |
| 端点 | 圆角端点(round) | 保持整体圆润风格,与组件圆角体系呼应 |
| 转角 | 圆角连接(round) | 拐角处不过于尖锐,符合现代 UI 风格 |
| 着色 | currentColor 唯一 | 禁止写死 fill / stroke 色值,确保主题/暗色切换正常 |
| 命名 | 目录/文件名 层级 | 与 assets/icons-v2/<目录>/<文件>.svg 一一对应,语义清晰 |
已有图标若存在风格不一致(描边粗细、端点、画布),建议在设计侧统一走一遍规范后再批量替换。
操作图标交互约束
业务中所有“操作类图标按钮”(关闭、返回、+、设置、编辑、删除等)必须统一使用 IconButton 组件,禁止自行用 <button> + <Icon> 实现。详细约束见:UIKIT UI 交互约束。
核心原则:
- 关闭按钮统一使用
xmark/light,由Popup的show-close或IconButton渲染。 - 返回按钮统一使用
chevron/left。 - 添加按钮统一使用
plus。 - 默认
variant="ghost"、size="small",统一圆角背景 hover,不手写 hover 样式。
覆盖与新增图标
替换已有图标:直接用同名 SVG 文件覆盖 packages/uikit-core/src/assets/icons-v2/<路径>.svg 即可,所有 name 引用不变,无需改动任何业务代码。面性图标放在 icons-v2/filled/<目录>/。建议使用 24×24 viewBox、currentColor 着色的 SVG,以保证与主题体系一致。
新增图标:
- 线性图标放入
packages/uikit-core/src/assets/icons-v2/<目录>/(目录层级即name前缀); - 面性图标放入
packages/uikit-core/src/assets/icons-v2/filled/<目录>/(name自动带filled/前缀); - 在代码中通过
<Icon name="目录/文件名" />引用即可。
构建时会自动执行 icons:check 校验:扫描源码中所有图标 name 引用并与图标库文件比对,引用不存在的图标会导致构建失败并列出缺失清单,避免图标静默不渲染。也可单独执行:
pnpm -F @easemob-community/uikit-im run icons:check许可与免责声明
本 UIKit 内置图标来源为设计师交付的线性图标集。当您自行替换或新增图标时,须自行确保对所用图标素材拥有合法的使用权(包括但不限于版权授权、商标许可);本项目不对用户自备素材的版权合规性承担任何责任。
