AshReports.Layout.Table (ash_reports v0.1.0)

A table layout container that maps to Typst's table() function.

Tables are intended for tabular data where the arrangement of cells conveys information. Unlike grids, tables carry semantic meaning and are accessible to assistive technologies.

Tables have different defaults than grids:

  • stroke defaults to "1pt" for visible borders
  • inset defaults to "5pt" for cell padding

Example

table :data_table do
  columns [fr(1), fr(2), fr(1)]
  stroke "0.5pt"
  inset "5pt"

  header repeat: true do
    cell do
      label text: "Name"
    end
    cell do
      label text: "Description"
    end
    cell do
      label text: "Value"
    end
  end

  # Data rows follow...
end

Summary

Types

alignment()

@type alignment() :: atom() | {atom(), atom()} | nil

t()

@type t() :: %AshReports.Layout.Table{
  align: alignment(),
  column_gutter: String.t() | nil,
  columns: pos_integer() | [track_size()],
  elements: [map()],
  fill: String.t() | (integer(), integer() -> String.t()) | nil,
  footers: [AshReports.Layout.Footer.t()],
  gutter: String.t() | nil,
  headers: [AshReports.Layout.Header.t()],
  inset: String.t() | nil,
  name: atom(),
  row_entities: [AshReports.Layout.Row.t()],
  row_gutter: String.t() | nil,
  rows: pos_integer() | [track_size()] | :auto | nil,
  stroke: String.t() | nil,
  table_cells: [AshReports.Layout.TableCell.t()]
}

track_size()

@type track_size() :: pos_integer() | String.t() | :auto | {:fr, number()}