TermUI.Widget.Progress (TermUI v1.0.0)
View SourceA widget for displaying progress bars and spinners.
Progress supports two modes:
- Bar mode: Shows a filled bar proportional to progress value
- Spinner mode: Shows an animated indicator for indeterminate progress
This module uses the earlier TermUI.Widget namespace, accepts a props map
directly, and must be embedded as an explicit state machine in the Elm root.
A host must call handle_event(:tick, state) to advance its spinner.
Usage
# Bar mode
Progress.render(%{value: 0.5}, state, area)
# With percentage
Progress.render(%{value: 0.75, show_percentage: true}, state, area)
# Spinner mode
Progress.render(%{mode: :spinner}, state, area)Props
:value- Progress value 0.0 to 1.0 (default: 0.0):mode-:baror:spinner(default::bar):show_percentage- Show percentage text (default:false):filled_char- Character for filled portion (default:"█"):empty_char- Character for empty portion (default:"░"):style- Style options for the bar
Summary
Functions
Handles events for the progress widget.
Initializes the progress widget state.
Renders the progress indicator.