# `Alaja.Components.Bar`
[🔗](https://github.com/Lorenzo-SF/alaja/blob/2.1.0/lib/alaja/components/bar.ex#L1)

Static progress bar component for terminal output.

Renders a horizontal bar representing a value as a proportion of a maximum.

## Usage

    iex> Alaja.Components.Bar.print(75, 100)
    # [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░] 75%

    iex> Alaja.Components.Bar.print(0.6, 1.0, label: "CPU", width: 40)
    # CPU [▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░] 60%

## Cell engine

As of v0.3.0, `render/3` returns an `Alaja.Buffer.t/0`. The label and
percent text are placed on the same row as the bar (left-aligned label,
right-aligned percent).

# `print`

```elixir
@spec print(number(), number(), keyword()) :: :ok
```

Prints a progress bar directly to stdout.

# `render`

```elixir
@spec render(number(), number(), keyword()) :: Alaja.Buffer.t()
```

Renders a progress bar to an `Alaja.Buffer.t/0`.

Layout (single row, total width = label_w + 1 + width + 1 + percent_w):
  [label ] [bar] [percent]

---

*Consult [api-reference.md](api-reference.md) for complete listing*
