# `Athanor.Components.Formatting`
[🔗](https://github.com/Arsenalist/athanor/blob/v0.1.0-beta.7/lib/athanor/components/formatting.ex#L1)

Shared formatting surface for Athanor primitives.

Every component that ships with Athanor wraps its render output in
`apply/1`, which emits a div with the inline styles + alignment class
derived from `node["props"]["formatting"]`. The field set matches the
legacy host-app formatting config exactly, so existing prod data
round-trips byte-equal.

## Field set (matches legacy `@style_options`)

- `text_color`         hex like `"#000000"`
- `background_color`   hex
- `padding_top`        integer px
- `padding_bottom`     integer px
- `padding_left`       integer px
- `padding_right`      integer px
- `border_radius`      integer px
- `border_width`       integer px
- `border_color`       hex
- `margin_top`         integer px
- `margin_bottom`      integer px
- `margin_left`        integer px
- `margin_right`       integer px

Plus `alignment` (`"left" | "center" | "right"`) which maps to a flex
utility class.

# `alignment_class`

Map the `alignment` formatting key to a Tailwind flex class. Falls back
to an empty string when unset or unknown.

# `apply`

Wrap rendered content with the formatting div.

Usage from a component's `render(:live, ...)`:

    def render(:live, node, _ctx) do
      formatting = node["props"]["formatting"] || %{}
      assigns = %{
        formatting: formatting,
        inner: ~H"<h2>{node["props"]["text"]}</h2>"
      }

      Athanor.Components.Formatting.apply(assigns)
    end

## Attributes

* `formatting` (`:map`) - Defaults to `%{}`.
* `inner` (`:any`) - Defaults to `nil`.
## Slots

* `inner_block`

# `build_style`

Compute the inline `style="..."` value from a formatting map. Returns
an empty string when no style fields are set.

# `style_options`

Static list of supported style field keys.

---

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