Skip to content

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。

属性类型默认值说明
namestring''
symbolResource | undefinedundefinedHarmonyOS Symbol 资源;优先于 name。
sizingnumber16vp
colorResourceColor | undefinedundefined默认为 foreground 令牌。
strokeWidthnumber2在 24 单位图标框中的描边宽度(lucide 默认为 2);随 sizing 缩放。

MIT Licensed