progress_bar (cellium v0.1.0)
View SourceProgress bar widget module for displaying task completion.
This module provides a visual progress bar widget that displays completion percentage using filled and unfilled block characters.
Usage
Basic progress bar:
progress_bar:new(my_progress)Progress bar with custom width and progress:
Widget = progress_bar:new(my_progress),
CustomWidget = Widget#{width => 40, progress => 0.75}Properties
progress(float): Completion percentage from 0.0 to 1.0. Default: 0.0width(integer): Total width of the progress bar including brackets. Default: 20focusable(boolean): Set to true by default
Display
The progress bar uses Unicode block characters:
█for filled portion (completed)░for unfilled portion (remaining)- Format:
[████████░░░░░░░░░░]
When focused, foreground and background colors are swapped.
Example
% 50% complete with width of 30
Widget#{progress => 0.5, width => 30}
% Displays: [██████████████░░░░░░░░░░░░░░]
Summary
Functions
Handles keyboard events for the progress bar. Adjusts progress with Left/Right arrow keys.
Creates a new progress bar with default settings.
Renders the progress bar in unfocused state.
Renders the progress bar in focused state with inverted colors.
Functions
Handles keyboard events for the progress bar. Adjusts progress with Left/Right arrow keys.
Creates a new progress bar with default settings.
Default progress is 0.0 (0%) and default width is 20 characters.
Renders the progress bar in unfocused state.
Renders the progress bar in focused state with inverted colors.