PetalComponents.Showcase.Example (petal_components v4.6.2)

Copy Markdown View Source

One showcase example.

  • id - atom; on marketing pages this is also the section anchor
  • title / description - human copy shown above the preview
  • code - the exact HEEx source the author wrote (drives the "View Code" panel)
  • render - a (assigns -> rendered) function that produces the live preview
  • highlighted - optional precompiled, syntax-highlighted {:safe, html} for code; nil when no highlighter (mdex + lumis) was available at compile time

Summary

Types

t()

@type t() :: %PetalComponents.Showcase.Example{
  code: String.t(),
  description: String.t() | nil,
  highlighted: {:safe, iodata()} | nil,
  id: atom(),
  render: (map() -> Phoenix.LiveView.Rendered.t()) | nil,
  title: String.t()
}