AccrueAdmin.Components.Detail (accrue_admin v1.5.0)

Copy Markdown View Source

Reusable building blocks for detail / object pages, following the Stripe-style skeleton: summary header → titled sections → label/value field lists.

These exist so every detail screen (subscription, customer, invoice, charge, connect account, webhook) shares one layout vocabulary instead of hand-rolling cards, reaping consistency dividends as they're reused.

Summary

Functions

A label → value field list (two columns). fields is a list of %{label: ..., value: ...} maps; values may be strings or rendered content. Monetary/numeric values inherit tabular figures from the admin root.

A titled section wrapper. Optional :actions slot renders on the right of the section header.

Summary header for a detail page: an eyebrow + identifier title, an optional status pill, and a primary-facts row, with an :actions slot on the right.

GOV.UK-style summary list for object detail headers. rows is a list of maps with :label, :value, and optional action keys

Functions

detail_field_list(assigns)

A label → value field list (two columns). fields is a list of %{label: ..., value: ...} maps; values may be strings or rendered content. Monetary/numeric values inherit tabular figures from the admin root.

Attributes

  • fields (:list) (required)
  • class (:any) - Defaults to nil.

detail_section(assigns)

A titled section wrapper. Optional :actions slot renders on the right of the section header.

<Detail.detail_section title="Line items">
  <:actions><.button>Add</.button></:actions>
  ...content...
</Detail.detail_section>

Attributes

  • title (:string) (required)
  • class (:any) - Defaults to nil.

Slots

  • actions
  • inner_block (required)

summary_card(assigns)

Summary header for a detail page: an eyebrow + identifier title, an optional status pill, and a primary-facts row, with an :actions slot on the right.

Attributes

  • eyebrow (:string) - Defaults to nil.
  • title (:string) (required)

Slots

  • status
  • facts
  • actions

summary_list(assigns)

GOV.UK-style summary list for object detail headers. rows is a list of maps with :label, :value, and optional action keys:

  • :action_label - visible action text, usually "Change" or "View"
  • :action_context - visually hidden context appended after the label
  • :action_event, :action_value, :action_target - LiveView button action
  • :action_href - link action

Use this for row-level actions in the page summary. Keep detail_field_list/1 for read-only drill-section field groups.

Attributes

  • rows (:list) (required)
  • class (:any) - Defaults to nil.