> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gavai.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Table

> Paginated, filterable, sortable view of records from a schema table.

export const Def = ({term, type, defaultValue, required, children}) => <>
    <dt className="gv-def-list__term">
      <span className="gv-def-list__name">{term}</span>
      {type && <span className="gv-def-list__type">{type}</span>}
      {required && <span className="gv-def-list__required">required</span>}
      {defaultValue !== undefined && <span className="gv-def-list__default">
          default <code>{defaultValue}</code>
        </span>}
    </dt>
    <dd className="gv-def-list__description">{children}</dd>
  </>;

export const DefList = ({children}) => <dl className="gv-def-list">{children}</dl>;

export const BrandCard = ({eyebrow, title, href, icon, badge, cta, featured = false, horizontal = false, children}) => {
  const classes = ["gv-card", featured && "gv-card--featured", horizontal && "gv-card--horizontal"].filter(Boolean).join(" ");
  const inner = <>
      {icon && <span className="gv-card__icon" aria-hidden="true">
          <Icon icon={icon} />
        </span>}
      <div className="gv-card__main">
        {(eyebrow || badge) && <div className="gv-card__meta">
            {eyebrow && <Eyebrow label={eyebrow} tone="muted" />}
            {badge && <span className="gv-card__badge">{badge}</span>}
          </div>}
        <h3 className="gv-card__title">{title}</h3>
        {children && <div className="gv-card__body">{children}</div>}
        {cta && <span className="gv-card__cta">
            {cta}
            <svg className="gv-card__cta-arrow" viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
              <line x1="7" y1="17" x2="17" y2="7" />
              <polyline points="7 7 17 7 17 17" />
            </svg>
          </span>}
      </div>
    </>;
  return href ? <a className={classes} href={href}>
      {inner}
    </a> : <div className={classes}>{inner}</div>;
};

export const FeatureTable = ({columns, rows, featuredRow, caption, variant}) => <div className={`gv-feature-table ${variant ? `gv-feature-table--${variant}` : ""}`}>
    <table>
      {caption && <caption className="gv-feature-table__caption">{caption}</caption>}
      <thead>
        <tr>
          {columns.map(col => <th key={col.key} scope="col">
              <span className="gv-feature-table__header">{col.label}</span>
            </th>)}
        </tr>
      </thead>
      <tbody>
        {rows.map((row, i) => {
  const rowClass = [i === featuredRow ? "gv-feature-table__row--featured" : "", row.chosen ? "gv-feature-table__row--chosen" : ""].filter(Boolean).join(" ");
  return <tr key={i} className={rowClass}>
              {columns.map(col => {
    const v = row[col.key];
    if (variant === "tradeoff" && Array.isArray(v)) {
      const pill = col.key === "pros" ? "gv-feature-table__pill--pro" : col.key === "cons" ? "gv-feature-table__pill--con" : "";
      return <td key={col.key}>
                      {v.map((item, j) => <span key={j} className={`gv-feature-table__pill ${pill}`}>{item}</span>)}
                    </td>;
    }
    return <td key={col.key}>{v}</td>;
  })}
            </tr>;
})}
      </tbody>
    </table>
  </div>;

export const Eyebrow = ({label, tone = "default"}) => <div className={`gv-eyebrow gv-eyebrow--${tone}`}>
    <span className="gv-eyebrow__bar" aria-hidden="true" />
    <span className="gv-eyebrow__label">{label}</span>
  </div>;

<Eyebrow label="BLOCK" />

`Table` renders a live, paginated list of rows from a schema table. This page explains the props, how the runtime queries the table, and how row-click navigation pairs Table with DetailPanel. You declare which columns to show; the runtime handles the query, pagination controls, filter bar, and sort headers.

## Example

```json table.json theme={null}
{
  "block": "Table",
  "props": {
    "schema_table": "customers",
    "columns": ["name", "email", "status", "created_at"],
    "sortable": true,
    "filterable": true,
    "page_size": 25,
    "on_row_click": { "navigate": "/customers/{{id}}" }
  }
}
```

## Props

<DefList>
  <Def term="schema_table" type="string" required>
    Name of the workspace schema table to query.
  </Def>

  <Def term="columns" type="string[]" required>
    Ordered list of column names to display as table columns.
  </Def>

  <Def term="sortable" type="boolean" defaultValue="false">
    When `true`, column headers become clickable sort controls.
  </Def>

  <Def term="filterable" type="boolean" defaultValue="false">
    When `true`, the runtime renders a filter bar above the table.
  </Def>

  <Def term="page_size" type="number" defaultValue="25">
    Rows per page. Maximum enforced by `runQuery` is 1000.
  </Def>

  <Def term="on_row_click" type="{ navigate }">
    Action on row click. Currently supports navigation to a URL template.
  </Def>
</DefList>

## How it binds to data

On render, the runtime issues a `runQuery` against `schema_table`. Sorting and filtering state is held client-side; user interactions trigger new `runQuery` calls. The query runs in the security context of the authenticated user, so row-level access is governed by your schema grants and the user's `authUser` roles.

### Row-click navigation

`on_row_click.navigate` is a URL template. The token `{{id}}` is replaced at runtime with the `id` field of the clicked row.

```json on-row-click.json theme={null}
"on_row_click": { "navigate": "/customers/{{id}}" }
```

This sends the user to `/customers/cust_01H...` when they click the row whose `id` is `cust_01H...`. The destination URL typically hosts a `DetailPanel` block that reads the same record.

## Patterns

<FeatureTable
  columns={[
{ key: "use", label: "Use case" },
{ key: "config", label: "Typical config" }
]}
  rows={[
{ use: "Customer list", config: "`columns: [name, email, status, created_at]`; click row to open the customer detail page." },
{ use: "Order list", config: "`columns: [order_number, total, fulfillment_status]`; default sort by `created_at` descending." },
{ use: "Internal admin list", config: "Any workspace table becomes a manageable list view without writing query logic." }
]}
/>

## Common props

In addition to the Table-specific props, every block accepts `id`, `class_overrides`, `visible_if`, and `analytics_event`. See [common props on the PageBlocks overview](/pageblocks/overview#common-props).

## Where to go next

<Columns cols={2}>
  <BrandCard eyebrow="BLOCK" title="DetailPanel" href="/pageblocks/blocks/detail-panel">
    Show and edit a single record — the natural destination for a row click.
  </BrandCard>

  <BrandCard eyebrow="BLOCK" title="KanbanBoard" href="/pageblocks/blocks/kanban-board">
    Same data, different shape — group rows by a status field into a drag-drop board.
  </BrandCard>
</Columns>
