MishkaGervaz.Form.Entities.Header (MishkaGervaz v0.0.1-alpha.3)

Copy Markdown View Source

Form header — static title + description pair rendered above the fields, with optional icon and a custom HEEx render escape hatch.

Visibility gating (visible / restricted) follows the same access conventions used by MishkaGervaz.Form.Entities.Field and MishkaGervaz.Form.Entities.Group. Title and description accept strings or zero-/one-arity functions, so they can render dynamic content from the form state.

Example

layout do
  header do
    title "Account Permissions"
    description "Configure what this account can access."
    icon "hero-shield-check"
    class "mb-6"
    visible fn state -> state.mode == :update end
  end
end

See MishkaGervaz.Form.Dsl.Layout for the surrounding section.

Summary

Types

t()

@type t() :: %MishkaGervaz.Form.Entities.Header{
  __spark_metadata__: map() | nil,
  class: String.t() | nil,
  description: String.t() | (-> String.t()) | (map() -> String.t()) | nil,
  extra: map(),
  icon: String.t() | nil,
  render:
    (map() -> Phoenix.LiveView.Rendered.t())
    | (map(), map() -> Phoenix.LiveView.Rendered.t())
    | nil,
  restricted: boolean() | (map() -> boolean()),
  title: String.t() | (-> String.t()) | (map() -> String.t()) | nil,
  visible: boolean() | (map() -> boolean())
}

Functions

transform(header)