LanternUI.Components.ResourceList (LanternUI v0.8.2)

Copy Markdown View Source

Resource list: a simple index of resources (projects, apps, databases, buckets). No Fluxon equivalent. Pure presentational server render; no JS hook.

<.resource_list layout={:list}>
  <.resource_list_item
    :for={p <- @projects}
    navigate={"/projects/" <> p.slug}
    title={p.name}
    subtitle={p.slug}
  >
    <.badge>Setup required</.badge>
    <.badge>4 configs</.badge>
  </.resource_list_item>
</.resource_list>

Prefer this over data_table when the page lists a handful of resources and does not need column headers, sort, pagination, or selection. The host owns any list/grid toggle; pass layout={:list} or layout={:grid}. Search, sort, and pagination stay out of scope on purpose.

The root is an unordered list (<ul>); each item is an <li>. layout lands as data-layout and CSS switches between full-width rows (hairline separators between items) and a card grid. When navigate, patch, or href is set, the whole row is the link hit target. The optional inner_block holds trailing meta (badges, counts): right-aligned in list layout, stacked under the title in grid layout.

Summary

Functions

resource_list(assigns)

Attributes

  • layout (:atom) - List (full-width rows) or grid (card layout). Rendered as data-layout. Defaults to :list. Must be one of :list, or :grid.
  • class (:any) - Extra classes merged onto the root element. Defaults to nil.
  • Global attributes are accepted. Arbitrary HTML/phx-* attributes passed through.

Slots

resource_list_item(assigns)

Attributes

  • title (:string) (required) - Primary line (resource name).
  • subtitle (:string) - Optional secondary line (e.g. a slug). Class only; face is CSS-owned. Defaults to nil.
  • subtitle_mono (:boolean) - Render the subtitle in the mono face. Set it when the subtitle is a value the SYSTEM produced (a slug, a domain, a bucket name) rather than language a human wrote. Surveying the six index pages this component targets, five carry a machine value there, so an opt-in beats every call site reaching for an override class. Defaults to false.
  • navigate (:string) - LiveView navigate target; whole row is a link. Defaults to nil.
  • patch (:string) - LiveView patch target; whole row is a link. Defaults to nil.
  • href (:string) - External or full-page href; whole row is a link. Defaults to nil.
  • class (:any) - Extra classes merged onto the item root. Defaults to nil.
  • Global attributes are accepted. Arbitrary HTML/phx-* attributes passed through.

Slots

  • inner_block - Trailing meta (badges, counts).