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_colorhex like"#000000"background_colorhexpadding_topinteger pxpadding_bottominteger pxpadding_leftinteger pxpadding_rightinteger pxborder_radiusinteger pxborder_widthinteger pxborder_colorhexmargin_topinteger pxmargin_bottominteger pxmargin_leftinteger pxmargin_rightinteger px
Plus alignment ("left" | "center" | "right") which maps to a flex
utility class.
Summary
Functions
Map the alignment formatting key to a Tailwind flex class. Falls back
to an empty string when unset or unknown.
Wrap rendered content with the formatting div.
Compute the inline style="..." value from a formatting map. Returns
an empty string when no style fields are set.
Static list of supported style field keys.
Functions
Map the alignment formatting key to a Tailwind flex class. Falls back
to an empty string when unset or unknown.
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)
endAttributes
formatting(:map) - Defaults to%{}.inner(:any) - Defaults tonil.
Slots
inner_block
Compute the inline style="..." value from a formatting map. Returns
an empty string when no style fields are set.
Static list of supported style field keys.