ProgressGroup

展示任务各部分的进度占比。

实时预览

正在加载预览…

参数配置

全部字段 10

ProgressGroupItems

列表项 · 3
ProgressSegment
ProgressSegment
ProgressSegment

ProgressGroupOptions

Styles · 0

Go 代码

Go
// Inside a view; c is *ui.Context, t is nui.Theme.
nui.ProgressGroup(c.Key("progress"), t, []nui.ProgressSegment{{ID: "code", Label: "Code", Value: 45, Color: nui.Primary}, {ID: "tests", Label: "Tests", Value: 30, Color: nui.Info}, {ID: "docs", Label: "Docs", Value: 15, Color: nui.Warning}}, nui.ProgressGroupOptions{Label: "Project progress", Size: nui.SizeDefault, HideLegend: false, Orientation: nui.Horizontal, Height: 160})

使用说明

代码、测试和文档三段使用固定示例数据,可比较隐藏图例和方向变化。每段使用独立 ID、数值和语义颜色,便于连接任务数据。

API 参考

ProgressGroup

源码
func ProgressGroup(c *ui.Context, t Theme, segments []ProgressSegment, opts ProgressGroupOptions) ui.Element

ProgressGroupOptions

源码
type ProgressGroupOptions struct {
	Label       string
	Max         Optional[float64]
	Color       Color
	Size        Size
	HideLegend  bool
	Orientation Orientation
	Height      float32
	Decoration
}
字段类型说明
Labelstring

Go 零值: ""

控件标签或可访问名称。

MaxOptional[float64]

Go 零值: unset

上界或数量上限,具体含义依组件而定。

ColorColor

Go 零值: ColorDefault

语义颜色;默认值继承主题或组件配色。

SizeSize

Go 零值: SizeDefault

组件尺寸;默认值继承主题或组件尺寸。

HideLegendbool

Go 零值: false

隐藏进度分组图例。

OrientationOrientation

Go 零值: zero value

水平或垂直方向;未设置时使用组件默认方向。

Heightfloat32

Go 零值: 0

高度,单位为 DIP。

UIStyles

Go 零值: zero value

以部件名称为键覆盖外观和间距。

Stylefunc(Slot, ui.Element)

Go 零值: nil

同步配置当前构建的部件;不要保留 Element。