progress

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package progress provides a thin wrapper around the native <progress> element with theme-aware styling.

Two variants:

  • Determinate — Value/Max are set; bar fills proportionally.
  • Indeterminate — Value < 0; the browser shows its native animated "in progress" stripe.

The component is server-rendered and does not require JavaScript. Drive updates from the server via a signal binding (data-fui-signal-attr=value) when you want a live progress bar without a page reload.

Index

Constants

This section is empty.

Variables

View Source
var Style = registry.RegisterStyle("progress", styleFn)

Style is the registered stylesheet handle. New's wrapping <div> goes through Style.WrapHTML so the data-fui-comp marker is emitted and the runtime auto-loads the CSS on first appearance.

Functions

func New

func New(cfg Config) render.HTML

New renders a <progress> element with the given configuration.

Required: Label (becomes aria-label).

Types

type Config

type Config struct {
	// Value is the current progress, between 0 and Max. A negative
	// Value renders an indeterminate (animated) bar.
	Value float64
	Max   float64 // defaults to 100 when zero

	// Label is the accessible name. Required for screen readers.
	Label string

	// Description optionally renders alongside the bar (e.g. "73 of 100"
	// or "Uploading file…"). Empty = no description rendered.
	Description string

	ID    string
	Class string
}

Config configures a progress bar.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL