sidebar-pptx-generator/references/component-faicon.md
2.9 KB查看排版效果| 1 | --- |
| 2 | name: component-faicon |
| 3 | description: FAIcon 图标组件规范 — Font Awesome 图标集成、必填属性、常用图标速查 |
| 4 | --- |
| 5 | |
| 6 | # FAIcon 组件规范 |
| 7 | |
| 8 | FAIcon 是 slidep 中承载所有**矢量图标**的组件,集成 Font Awesome 图标集。相比 Emoji 更统一、可着色、尺寸可控,在专业演示文稿中**优先使用 FAIcon,严禁混用 Emoji**。 |
| 9 | |
| 10 | ## 必填属性 |
| 11 | |
| 12 | ```jsx |
| 13 | <FAIcon name='chart-line' style={{ fill: '#3b82f6', width: 32, height: 32 }} /> |
| 14 | ``` |
| 15 | |
| 16 | | 属性 | 必填 | 说明 | |
| 17 | | :--- | :--- | :--- | |
| 18 | | `name` | ✅ | 图标名称(如 `'heart'` / `'chart-line'` / `'check-circle'`),必须是 Font Awesome 中存在的名称 | |
| 19 | | `fill` | ✅ | 填充色。**不设置则完全不可见**(默认透明) | |
| 20 | | `width` / `height` | 推荐 | 尺寸,默认 24px,推荐范围 24-48px;超大图标(巨型 Header)可到 64-128px | |
| 21 | | `stroke` / `strokeWidth` | 可选 | 描边颜色与宽度(仅部分线框图标支持) | |
| 22 | |
| 23 | ## 常用图标速查 |
| 24 | |
| 25 | | 类别 | 图标名 | |
| 26 | | :--- | :--- | |
| 27 | | **基础** | `home` / `user` / `users` / `heart` / `star` / `check` / `times` / `plus` | |
| 28 | | **箭头** | `arrow-right` / `arrow-left` / `arrow-up` / `arrow-down` / `chevron-right` | |
| 29 | | **文件** | `file` / `folder` / `file-text` / `copy` / `clipboard` | |
| 30 | | **商务** | `briefcase` / `chart-line` / `chart-bar` / `dollar` / `calendar` / `clock` | |
| 31 | | **状态** | `check-circle` / `times-circle` / `exclamation-circle` / `info-circle` | |
| 32 | | **安全** | `lock` / `unlock` / `shield` / `key` / `eye` | |
| 33 | | **工具** | `cog` / `wrench` / `edit` / `pencil` / `trash` | |
| 34 | | **通讯** | `envelope` / `phone` / `comment` / `share` | |
| 35 | |
| 36 | 需要其他图标时先查 Font Awesome 官方图标库确认名称存在,**严禁编造图标名**(编造会导致校验失败 / 构建出空白图形)。 |
| 37 | |
| 38 | ## 使用场景 |
| 39 | |
| 40 | ### 要点卡片锚点 |
| 41 | |
| 42 | ```jsx |
| 43 | <Box style={{ flexDirection: 'row', gap: 16, alignItems: 'flex-start' }}> |
| 44 | <FAIcon name='check-circle' style={{ fill: '#10b981', width: 32, height: 32 }} /> |
| 45 | <Box> |
| 46 | <Text style={{ fontSize: 18, fontWeight: 'bold' }}>自动化流程</Text> |
| 47 | <Text style={{ fontSize: 14, color: '#64748b' }}>减少 80% 人工干预</Text> |
| 48 | </Box> |
| 49 | </Box> |
| 50 | ``` |
| 51 | |
| 52 | ### 带背景容器的强调图标 |
| 53 | |
| 54 | ```jsx |
| 55 | <Box style={{ |
| 56 | width: 64, height: 64, |
| 57 | borderRadius: 16, |
| 58 | background: '#eff6ff', |
| 59 | justifyContent: 'center', |
| 60 | alignItems: 'center', |
| 61 | }}> |
| 62 | <FAIcon name='rocket' style={{ fill: '#3b82f6', width: 32, height: 32 }} /> |
| 63 | </Box> |
| 64 | ``` |
| 65 | |
| 66 | ### 巨型 Header 锚点 |
| 67 | |
| 68 | ```jsx |
| 69 | <FAIcon name='chart-line' style={{ fill: '#3b82f6', width: 96, height: 96, opacity: 0.9 }} /> |
| 70 | ``` |
| 71 | |
| 72 | ## 风格一致性 |
| 73 | |
| 74 | - **粗细与圆角**必须在整份 PPT 中保持统一,不要混用"实心图标 + 线框图标"或"方形 + 圆形" |
| 75 | - 同一卡片组内的图标**尺寸统一**(全 32×32 或全 48×48) |
| 76 | - 图标着色优先用主题色(`accent1` / `accent2`),避免自创对比色 |
文件内容是平台检查时读出的文本,只供查看。平台不会运行包里的任何脚本或程序。

