The ~PDF authoring surface.
defmodule MyDoc do
use Mead.Component
attr :title, :string, required: true
slot :inner_block
def panel(assigns) do
~PDF"""
<view padding="10" background="#EEF1FA" gap="6">
<text font_size="14" color="#283C86">{@title}</text>
{render_slot(@inner_block)}
</view>
"""
end
end
Mead.render(MyDoc.panel(%{title: "Hello", inner_block: []}))use Mead.Component pulls in Phoenix.Component (for attr/slot
declarations and their compile-time validation) and the ~PDF sigil.
Attributes are string-typed and CSS-like; see Mead.Markup for the
accepted values. Templates compile through Phoenix.LiveView.TagEngine
with Mead.TagHandler, so unknown tags and malformed component calls
are compile-time errors.
Summary
Functions
Compiles a Mead template. Requires an assigns variable in scope.