Icon
按需使用 Lucide 矢量图标。
实时预览
正在加载预览…
参数配置
全部字段 5
IconOptions
Go 代码
Go
// Inside a view; c is *ui.Context, t is nui.Theme.
nui.Icon(c.Key("icon"), t, lucide.Check(), nui.IconOptions{Size: nui.Set(float32(40)), Label: "Example icon"}).AlignSelf(ui.Start)使用说明
选择 Lucide 图标并调整像素尺寸,预览直接绘制 SVG。完整示例展示图标包的按需导入;仅图标控件应提供能说明用途的 Label。
API 参考
Icon
源码func Icon(c *ui.Context, t Theme, svg *ui.SVG, opts IconOptions) ui.ElementIconOptions
源码type IconOptions struct {
Size Optional[float32]
Color Optional[ui.Color]
Label string
Decoration
}| 字段 | 类型 | 说明 |
|---|---|---|
Size | Optional[float32]Go 零值: | 组件尺寸;默认值继承主题或组件尺寸。 |
Color | Optional[ui.Color]Go 零值: | 语义颜色;默认值继承主题或组件配色。 |
Label | stringGo 零值: | 控件标签或可访问名称。 |
UI | StylesGo 零值: | 以部件名称为键覆盖外观和间距。 |
Style | func(Slot, ui.Element)Go 零值: | 同步配置当前构建的部件;不要保留 Element。 |