HawkExDashboard.Table (hawk_ex_dashboard v0.1.0)

Copy Markdown View Source

Shared table shell per design spec §5 — search, sort, pagination, loading/empty/error states. All state (search query, current page, sort column) is owned by the parent LiveView and passed in as assigns; this component only renders and emits events.

Supports two row-data modes:

  • rows — a plain list, fully re-rendered each update
  • stream — a Phoenix.LiveView.LiveStream, for high-volume or continuously-updating lists (see spec §6) Exactly one of rows/stream should be passed.

Summary

Functions

table(assigns)

Attributes

  • id (:string) (required)
  • rows (:list) - Defaults to [].
  • stream (:any) - Defaults to nil.
  • row_id (:any) - Defaults to nil.
  • page (:integer) - Defaults to nil.
  • total_pages (:integer) - Defaults to nil.
  • total_count (:integer) - Defaults to nil.
  • search (:string) - Defaults to "".
  • search_placeholder (:string) - Defaults to "Search…".
  • show_search (:boolean) - Defaults to true.
  • loading (:boolean) - Defaults to false.
  • error (:string) - Defaults to nil.
  • empty_title (:string) - Defaults to "No data".
  • empty_message (:string) - Defaults to "Nothing to show yet.".
  • sort_field (:string) - Defaults to nil.
  • sort_dir (:string) - Defaults to "desc".
  • compact (:boolean) - Defaults to false.

Slots

  • col (required) - Accepts attributes:
    • label (:string) (required)
    • sortable (:boolean)
    • field (:string)