Icons 图标
SparkUI 自带 199 个 lucide 图标。可以用 SparkIcons.register() 注册更多图标,或用 SparkIcons.useSymbol() 把名字映射到 HarmonyOS Symbol。
基础用法
arkts
SIcon({ name: 'heart', sizing: 20, color: theme.colors.destructive })API
从组件库源码中的 @Param / @Event / @BuilderParam 声明自动提取。
SIcon
统一图标。按名称渲染 lucide 矢量图标;若通过 SparkIcons.useSymbol() 映射了名称,或直接通过 symbol 传入,则渲染为 HarmonyOS Symbol。
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
name | string | '' | |
symbol | Resource | undefined | undefined | HarmonyOS Symbol 资源;优先于 name。 |
sizing | number | 16 | vp |
color | ResourceColor | undefined | undefined | 默认为 foreground 令牌。 |
strokeWidth | number | 2 | 在 24 单位图标框中的描边宽度(lucide 默认为 2);随 sizing 缩放。 |