ElementorexCms.Builder (ElementorexCms v0.1.0)

Copy Markdown View Source

Builds documents in Elixir: for templates, seeds and tests.

import ElementorexCms.Builder

doc([
  section([
    block("heading", %{text: "Hello", level: "h1"}, style: %{"mobile" => %{"font-size" => "28px"}}),
    block("text", %{text: "<p>Welcome!</p>"}),
    block("button", %{label: "Start", url: "/start", icon: "arrow-right"})
  ])
])

Props get the defaults of their block, so only what differs needs to be given. Pass registry: to build with a custom registry.

Summary

Functions

A node of type. Options: :id, :children, :style (per state), :attrs (Advanced settings) and :registry.

A grid whose columns are the given lists of children (one container per column).

A flex container with these children.

A document with these root children.

A section with these children.

Functions

block(type, props \\ %{}, opts \\ [])

@spec block(String.t(), map() | keyword(), keyword()) :: map()

A node of type. Options: :id, :children, :style (per state), :attrs (Advanced settings) and :registry.

columns(columns, props \\ %{}, opts \\ [])

A grid whose columns are the given lists of children (one container per column).

container(children, props \\ %{}, opts \\ [])

A flex container with these children.

doc(children, opts \\ [])

@spec doc([map()], keyword()) :: ElementorexCms.Document.t()

A document with these root children.

section(children, props \\ %{}, opts \\ [])

A section with these children.