Skip to content

Examples

All 40 examples live in the examples/ directory. Build them all with:

bash
zig build examples

Run every example sequentially:

bash
zig build run-all-examples

Run a single example:

bash
zig build run-<example-name>

Progress Bars

ExampleWhat it shows
basic_barMinimal bar with {bar} {percent}%.
custom_ascii_barASCII #/-/> style.
custom_bracket_barCustom brackets and head characters.
block_barBlock-based bar with partial fills.
indeterminateSliding segment for unknown progress.
indeterminate_timeoutIndeterminate bar with timeout auto-stop.
manual_tickManual .none thread mode with tick().
auto_thread.auto background-thread rendering.
external_threadUpdates from an external thread.
starting_valuecurrent initial value, decremental direction.
progress_bar_unicodeUnicode block characters with color.
progress_bar_countdownCountdown bar with decremental direction.
progress_bar_countdown_etaCountdown with ETA and speed formatters.

Spinners

ExampleWhat it shows
basic_spinnerMinimal spinner with {frame} {text}.
dynamic_spinner_messagessetText / setColor mid-run.
spinner_looping_messagesCycling text messages.
spinner_conditional_messagesPhase-based text changes.
infinite_spinnerAuto-threaded infinite spinner with stop.
spinner_brailleBraille dot spinner frames.

Multi-Progress & Batch

ExampleWhat it shows
multi_bar_sequentialMultiBar sequential mode.
multi_bar_parallelMultiBar parallel mode.
batch_sequentialBatchRunner over a slice.
batch_parallel_downloadsParallel workers with per-item + overall bars.
batch_dynamic_messagesWorkers updating text dynamically.

Step Sequences

ExampleWhat it shows
step_sequence_basicSpinner and bar steps, completeStep / failStep.
step_runallrunAll runner, skip, summary printing.

Colors

ExampleWhat it shows
custom_colors_rgbRaw ANSI RGB strings.
custom_colors_hexHEX → RGB escape sequences.
custom_colors_dynamic_gradientGradient computed per update.

Advanced

ExampleWhat it shows
template_with_eta_speed{elapsed} / {eta} / {speed} formatters.
runtime_style_swapsetStyle mid-run — Phase A → Phase B.
runtime_frame_swapsetFrames mid-run — ASCII → emoji → moon phases.
pause_resumepause / continue_ semantics.
text_updatesDynamic text updates.
dynamic_messagesText + color + style changes by phase.
infinite_progress_barAuto-threaded infinite bar, fail to stop.
clear_on_finishFinishConfig.clear and post-run output via stdoutWriter.
fail_and_statusfail + getStatus checks.
callback_hookson_tick / on_finish / on_pause / on_resume.
state_accessorReading state() snapshots.

Released under the MIT License.