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

Canonical renderer for `Alaja.Structures.MessageInfo`.

Returns an `Alaja.Buffer.t/0` so the result can be composed with
`Alaja.Components.Box`, `Alaja.Components.Header`, or any other
Cell-engine component.

## Why this exists

Before this component existed, `Alaja.CLI.Commands.Show.Message`
flattened the `MessageInfo` to a colored string with ANSI escapes
and handed it to `Components.Box.render/2`. The box then measured
the width with `String.length/1` which counted ANSI escapes as
characters, producing a box that was much wider than the visible
content.

With this component in place the flow is:

    MessageInfo → Components.Message.render/1 → Buffer
                                              ↓
                                     Box.render(buffer, opts)
                                              ↓
                                         final Buffer

Both pieces know each other's width because they speak Buffer.

## Options

The component honors the `:align`, `:padding`, and `:add_line`
options carried in the `MessageInfo` struct itself. No additional
options are read here.

# `render`

```elixir
@spec render(Alaja.Structures.MessageInfo.t()) :: Alaja.Buffer.t()
```

Renders a `MessageInfo` into an `Alaja.Buffer.t/0`.

Returns an empty Buffer (0x1) when given an empty chunks list.

---

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