Skip to content
GitHub

Grid

Grid manifests define CSS grid-based layouts with row and column headers, allowing you to organize child components in a structured tabular format. Grids are useful for creating dashboards, comparison views, and data matrices where components need to be arranged in rows and columns.

apiVersion: bino.bi/v1alpha1
kind: Grid
metadata:
  name: comparison-grid
spec:
  chartTitle: Regional Sales Overview
  rowHeaders:
    - label: Electronics
      id: electronics
    - label: Apparel
      id: apparel
    - label: Home & Garden
      id: home
  columnHeaders:
    - label: Q1
      id: q1
    - label: Q2
      id: q2
    - label: Q3
      id: q3
  showRowHeaders: true      # default: true
  showColumnHeaders: true   # default: true
  showBorders: true         # default: true
  rowHeaderWidth: auto      # CSS width (auto, 100px, 20%)
  cellGap: 0px              # CSS gap between cells
  children:
    - row: electronics
      column: q1
      kind: ChartStructure
      ref: electronics-q1-chart
    - row: electronics
      column: q2
      kind: Table
      spec:
        dataset: electronics-q2-data
        tableTitle: Q2 Sales
FieldTypeDefaultDescription
chartTitlestring""Title displayed at the top-left of the grid.
rowHeadersarray(required)Row header definitions. Can be simple strings or objects with label and id.
columnHeadersarray(required)Column header definitions. Can be simple strings or objects with label and id.

Row and column headers support two formats:

Simple format - Labels only, IDs are auto-generated as 0, 1, 2, etc.:

rowHeaders:
  - Electronics
  - Apparel
  - Home & Garden
columnHeaders:
  - Q1
  - Q2
  - Q3

Explicit format - Custom IDs for child references:

rowHeaders:
  - label: Electronics
    id: electronics
  - label: Apparel
    id: apparel
columnHeaders:
  - label: Q1 2024
    id: q1
  - label: Q2 2024
    id: q2
FieldTypeDefaultDescription
showRowHeadersbooleantrueWhether to display the row headers column.
showColumnHeadersbooleantrueWhether to display the column headers row.
showBordersbooleantrueWhether to display border/divider lines between cells.
rowHeaderWidthstring"auto"CSS width of the row header column (e.g., "auto", "100px", "20%").
cellGapstring"0px"CSS gap between grid cells (e.g., "0px", "8px").
FieldTypeDescription
childrenarrayArray of child definitions. Each child specifies its grid position and content.

Each child object has these properties:

PropertyTypeRequiredDescription
rowstring or integerYesRow identifier matching a row ID from rowHeaders. Can be string or integer.
columnstring or integerYesColumn identifier matching a column ID from columnHeaders. Can be string or integer.
kindstringYesComponent type: Text, Table, ChartStructure, ChartTime, ChartTree, or Image.
refstringNoReference to a standalone component document by name.
optionalbooleanNoWhen true, skip gracefully if ref is missing (default: false).
specobjectConditionalComponent specification. Required for inline children, optional override for ref children.
metadataobjectNoOptional metadata including name and constraints.

Grid children can reference existing component documents or define components inline.

children:
  - row: electronics
    column: q1
    kind: ChartStructure
    ref: electronics-q1-chart
children:
  - row: electronics
    column: q2
    kind: Table
    spec:
      dataset: sales-data
      tableTitle: Electronics Q2
      scenarios: ac,fc

Combine a reference with inline spec to override specific properties:

children:
  - row: electronics
    column: q3
    kind: ChartStructure
    ref: electronics-base-chart
    spec:
      chartTitle: Q3 Electronics  # Override the base chart's title
      filter: quarter == 'Q3'     # Add a filter

Mark a reference as optional to skip the child gracefully if the referenced component doesn’t exist:

children:
  - row: home
    column: q3
    kind: Table
    ref: home-q3-table
    optional: true  # Skip if not found instead of erroring

Children can include constraints that determine if they appear based on artefact labels, spec fields, or execution mode:

children:
  - row: electronics
    column: q1
    kind: ChartStructure
    ref: detailed-chart
    metadata:
      name: detailed-electronics-q1
      constraints:
        - mode == build
        - labels.detail == high
  - row: electronics
    column: q1
    kind: Text
    spec:
      value: "Summary view"
    metadata:
      name: summary-electronics-q1
      constraints:
        - mode == preview

Grid can be used as a child component in LayoutPage or LayoutCard:

With simple headers, use integers for row/column references:

---
apiVersion: bino.bi/v1alpha1
kind: Grid
metadata:
  name: sales-matrix
spec:
  rowHeaders: [North, South, East, West]
  columnHeaders: [Revenue, Units, Margin]
  children:
    - row: 0
      column: 0
      kind: Text
      spec:
        dataset: north-revenue
        value: "${revenue}"
    - row: 0
      column: 1
      kind: Text
      spec:
        dataset: north-units
        value: "${units}"
    # ... more children
---
apiVersion: bino.bi/v1alpha1
kind: LayoutPage
metadata:
  name: dashboard
spec:
  pageLayout: full
  children:
    - kind: Grid
      ref: sales-matrix
---
apiVersion: bino.bi/v1alpha1
kind: LayoutPage
metadata:
  name: dashboard
spec:
  pageLayout: full
  children:
    - kind: Grid
      metadata:
        name: inline-grid
      spec:
        chartTitle: Inline Grid Example
        rowHeaders: [A, B]
        columnHeaders: [X, Y]
        children:
          - row: 0
            column: 0
            kind: Text
            spec:
              value: "Cell A-X"
          - row: 1
            column: 1
            kind: Text
            spec:
              value: "Cell B-Y"

A product comparison grid with multiple component types:

---
apiVersion: bino.bi/v1alpha1
kind: Grid
metadata:
  name: product-comparison
  description: Quarterly product performance comparison
spec:
  chartTitle: Product Performance Matrix
  rowHeaders:
    - label: Laptops
      id: laptops
    - label: Tablets
      id: tablets
    - label: Phones
      id: phones
  columnHeaders:
    - label: Revenue
      id: rev
    - label: Units Sold
      id: units
    - label: Trend
      id: trend
  showRowHeaders: true
  showColumnHeaders: true
  showBorders: true
  rowHeaderWidth: 120px
  cellGap: 4px
  children:
    # Laptop row
    - row: laptops
      column: rev
      kind: Text
      spec:
        dataset: laptop-revenue
        value: "${total_revenue} EUR"
    - row: laptops
      column: units
      kind: Text
      spec:
        dataset: laptop-units
        value: "${units_sold}"
    - row: laptops
      column: trend
      kind: ChartTime
      ref: laptop-trend-chart

    # Tablet row
    - row: tablets
      column: rev
      kind: Table
      ref: tablet-revenue-table
    - row: tablets
      column: units
      kind: Text
      spec:
        dataset: tablet-units
        value: "${units_sold}"
    - row: tablets
      column: trend
      kind: ChartTime
      ref: tablet-trend-chart

    # Phone row
    - row: phones
      column: rev
      kind: ChartStructure
      ref: phone-revenue-chart
    - row: phones
      column: units
      kind: Text
      spec:
        dataset: phone-units
        value: "${units_sold}"
    - row: phones
      column: trend
      kind: ChartTime
      ref: phone-trend-chart

Grid appearance is controlled via ComponentStyle under the bn-grid key:

apiVersion: bino.bi/v1alpha1
kind: ComponentStyle
metadata:
  name: custom-style
spec:
  content:
    bn-grid:
      headerBackground: "#f5f5f5"
      borderColor: "#cccccc"
      borderWidth: 1
      cellPadding: 8

See ComponentStyle for all available grid styling options.