PhiaUiDesign.Web.ComponentRenderer (phia_ui v0.1.17)

Copy Markdown View Source

Renders real PhiaUI components dynamically for the design canvas.

Attempts to call the actual component function with the node's attrs and slots. Falls back gracefully to {:error, reason} on any failure so the editor can show a placeholder instead.

Slot construction

inner_block text content is wrapped in a proper Phoenix slot struct so that render_slot(@inner_block) works inside the target component. Named slots are not supported yet (they require compile-time HEEx).

Summary

Functions

Render a PhiaUI component to an HTML string.

Functions

render_to_html(module, func_name, attrs, slots)

@spec render_to_html(module() | nil, atom(), map(), map()) ::
  {:ok, String.t()} | {:error, String.t()}

Render a PhiaUI component to an HTML string.

Returns {:ok, html_string} on success, {:error, reason} on failure.