Skip to content

FxIcon 图标 ​

基于 iconify 的图标组件,通过 name="前缀:图标名" 使用各图标集(Element Plus、Ant Design 等)。

Element Plus 图标 ​

Ant Design 图标 ​

不同尺寸 ​

颜色 ​

通过 color 指定图标颜色,支持任意合法的颜色值(颜色字面量、@fx/styles 的 --color-* token 等);默认 currentColor,跟随父元素文字颜色,亮暗模式自动跟随。

Props ​

属性类型默认值说明
namestring—图标名,格式 前缀:图标名(如 ep:user、ant-design:home-filled)
sizenumber | string'16px'图标尺寸(px)
colorstring'currentColor'图标颜色
customClassstring—自定义类名

FxIconPicker 图标选择器 ​

图标选择器组件,支持搜索、按图标集(本地 SVG / Element Plus / Ant Design)分类选择,v-model 绑定图标名。

基础用法 ​

尺寸 ​

(large / default / small),默认 default。

清空 / 禁用 / 只读 ​

clearable 有值时悬停触发器显现清空按钮(默认 ep:circle-close,可经 clear-icon 自定义),点击清空绑定值并派发 clear 事件;disabled 置灰不可交互,readonly 不可交互但外观不变。

Props ​

属性类型默认值说明
modelValuestring—绑定值,图标名(v-model)
placeholderstring'请选择图标'占位提示
size'large' | 'default' | 'small''default'输入框尺寸(同 FxInput)
heightnumber418弹层高度(px)
themeIconPickerTheme | Ref | (() => IconPickerTheme)—主题配置(纯对象 / ref / computed / getter 函数皆可),键见下方「主题」
disabledbooleanfalse禁用(不可点击、触发器置灰)
readonlybooleanfalse只读(不可点击,外观不变灰)
clearablebooleanfalse是否显示清空按钮(有值时悬停触发器显现)
clearIconstring | Component'ep:circle-close'清空按钮图标(clearable 时生效):FxIcon 图标名字符串或组件

Events ​

事件说明
update:modelValue图标名变化时触发
clear点击清空按钮时触发,(evt?: MouseEvent);清空后绑定值为 ''

主题 ​

组件走 --fip-* 主题契约:包内不引用任何外部令牌,所有视觉值都是 var(--fip-*, 字面量)——独立发包即内置中性亮色主题;外部经 theme prop 传入配置,组件根节点内联落 CSS 变量(值可直接写 var(--color-*) 等,亮暗自动跟随)。

可用键:primary / primaryLight / bg / bgHover / text / textSecondary / textPlaceholder / activeText / border / borderLight / borderHover / radius / radiusLg / inputRadius / popoverShadow / transition。

vue
<script setup lang="ts">
import { FxIconPicker, type IconPickerTheme } from '@fx-core/icon'

// 键 → var(--color-*):亮暗随文档站主题自动翻转
const pickerTheme: IconPickerTheme = {
  primary: 'var(--color-primary)',
  bg: 'var(--color-bg)',
  text: 'var(--color-text)',
  border: 'var(--color-border)',
}
</script>

<template>
  <FxIconPicker v-model="selectedIcon" :theme="pickerTheme" />
</template>

本文档站

已通过全局样式把 --fip-* 全量映射到 --color-* 令牌,本页示例亮暗自动跟随,无需逐个传 theme;应用侧(@fx 管理端)的映射见 frontend/web/src/constants/icon-picker-theme.ts。