Documentation
¶
Overview ¶
Package progress provides a determinate progress bar.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProgressElement ¶
type ProgressElement struct {
// Contextual gives it a context menu (Context).
elements.Contextual
kit.HoverTracker
// contains filtered or unexported fields
}
ProgressElement is the bar: a rounded track box holding a row of the fill and the rest, sized by flex growth in proportion to the value.
func Progress ¶
func Progress(value float32, st ...styles.Styles) *ProgressElement
Progress is a stateless determinate progress bar. It expands to the available width; the height defaults to 8px. Color is the fill and Background is the track. Chain OnHover to add hover styles.
func (*ProgressElement) Label ¶
func (p *ProgressElement) Label(s string) *ProgressElement
Label names the bar for screen readers ("Uploading report.pdf"), which read its value as a percentage. It returns p for chaining.
func (*ProgressElement) Layout ¶
func (p *ProgressElement) Layout(gtx layout.Context) layout.Dimensions
Layout lays the bar out.
func (*ProgressElement) OnHover ¶
func (p *ProgressElement) OnHover(st styles.Styles) *ProgressElement
OnHover sets styles applied while the pointer is over the bar, merged on top of its base styles. Hover state lives in the element, so create it once and reuse it every frame; rebuilding it in the view function resets the hover on each frame.