Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Web docs
Data displayGlass surface

Table

Styles semantic tables for records and comparisons.

Frameworks
Astro · React · Elements · Dioxus
Registry
lumen add Table
Interaction
Enhanced runtime
01

See it and copy it

Framework example

Choose Astro, React, Elements, or Dioxus to compare native usage against the shared visual output. Each example assumes the framework-level setup is already complete.

AstroCode target · live preview uses Astro
CustomerStatusDueAmountActions
Linden StudioInvoice 1042
PaidDec 4, 2026$1,240.00
Aster BakeryInvoice 1043
SentDec 18, 2026$860.00
Cobalt LabsInvoice 1044
OverdueNov 28, 2026$2,010.00
Total$4,110.00
View Table code

Framework usage

Switch targets to compare the adapter code. This live preview runs the Astro example. Before copying an example, complete the matching framework setup; React, Elements, and Dioxus use their own behavior APIs.Width controls resize the preview container. Resize your browser to test viewport breakpoints.
astro
---
import { Avatar, Badge, Button, Icon, Stack, Table, VisuallyHidden } from '@santi020k/lumen-astro'
---

<Table aria-label="Invoices" layout="records" role="region" tabindex="0">
  <table role="table">
    <thead role="rowgroup">
      <tr role="row">
        <th class="ui-table__cell--title" role="columnheader" scope="col">Customer</th>
        <th role="columnheader" scope="col">Status</th>
        <th role="columnheader" scope="col">Due</th>
        <th data-numeric="true" role="columnheader" scope="col">Amount</th>
        <th role="columnheader" scope="col"><VisuallyHidden>Actions</VisuallyHidden></th>
      </tr>
    </thead>
    <tbody role="rowgroup">
      <tr role="row">
        <td class="ui-table__cell--title" role="cell">
          <Stack align="center" direction="horizontal" gap="sm">
            <Avatar aria-hidden="true" fallback="LS" />
            <span>
              <a class="ui-table__row-link" href="?invoice=1042">Linden Studio</a>
              <span class="ui-table__meta">Invoice 1042</span>
            </span>
          </Stack>
        </td>
        <td role="cell">
          <span class="ui-table__label" aria-hidden="true">Status</span>
          <Badge dot variant="success">Paid</Badge>
        </td>
        <td role="cell">
          <span class="ui-table__label" aria-hidden="true">Due</span>
          Dec 4, 2026
        </td>
        <td class="ui-table__cell--trailing" data-numeric="true" role="cell">$1,240.00</td>
        <td class="ui-table__cell--actions" role="cell">
          <Button aria-label="Actions for Linden Studio" size="icon" variant="ghost">
            <Icon decorative name="ellipsis" />
          </Button>
        </td>
      </tr>
      <tr role="row">
        <td class="ui-table__cell--title" role="cell">
          <Stack align="center" direction="horizontal" gap="sm">
            <Avatar aria-hidden="true" fallback="AB" />
            <span>
              <a class="ui-table__row-link" href="?invoice=1043">Aster Bakery</a>
              <span class="ui-table__meta">Invoice 1043</span>
            </span>
          </Stack>
        </td>
        <td role="cell">
          <span class="ui-table__label" aria-hidden="true">Status</span>
          <Badge dot variant="info">Sent</Badge>
        </td>
        <td role="cell">
          <span class="ui-table__label" aria-hidden="true">Due</span>
          Dec 18, 2026
        </td>
        <td class="ui-table__cell--trailing" data-numeric="true" role="cell">$860.00</td>
        <td class="ui-table__cell--actions" role="cell">
          <Button aria-label="Actions for Aster Bakery" size="icon" variant="ghost">
            <Icon decorative name="ellipsis" />
          </Button>
        </td>
      </tr>
      <tr role="row">
        <td class="ui-table__cell--title" role="cell">
          <Stack align="center" direction="horizontal" gap="sm">
            <Avatar aria-hidden="true" fallback="CL" />
            <span>
              <a class="ui-table__row-link" href="?invoice=1044">Cobalt Labs</a>
              <span class="ui-table__meta">Invoice 1044</span>
            </span>
          </Stack>
        </td>
        <td role="cell">
          <span class="ui-table__label" aria-hidden="true">Status</span>
          <Badge dot variant="destructive">Overdue</Badge>
        </td>
        <td role="cell">
          <span class="ui-table__label" aria-hidden="true">Due</span>
          Nov 28, 2026
        </td>
        <td class="ui-table__cell--trailing" data-numeric="true" role="cell">$2,010.00</td>
        <td class="ui-table__cell--actions" role="cell">
          <Button aria-label="Actions for Cobalt Labs" size="icon" variant="ghost">
            <Icon decorative name="ellipsis" />
          </Button>
        </td>
      </tr>
    </tbody>
    <tfoot role="rowgroup">
      <tr role="row">
        <th colspan="3" role="rowheader" scope="row">Total</th>
        <td data-numeric="true" role="cell">$4,110.00</td>
        <td role="cell"></td>
      </tr>
    </tfoot>
  </table>
</Table>
Edit Table in browser

Condensed columns

Use layout="condensed" when a narrow table should stay a table. While the table is narrower than 48rem, columns marked ui-table__cell--secondary step aside, and a ui-table__narrow line in the title cell repeats their values. scrollCue adds a hint while the remaining columns still overflow.

AstroCode target · live preview uses Astro
ServiceEnvironmentRegionStatusDuration
checkout-apiProductioneu-west-1Productioneu-west-1Live2m 14s
search-indexerStagingus-east-1Stagingus-east-1Building4m 02s
billing-workerProductionus-east-1Productionus-east-1Failed0m 48s
docs-sitePrevieweu-west-1Previeweu-west-1Live1m 31s
View Table code

Framework usage

Switch targets to compare the adapter code. This live preview runs the Astro example. Before copying an example, complete the matching framework setup; React and Elements use their own behavior APIs.Width controls resize the preview container. Resize your browser to test viewport breakpoints.
astro
---
import { Badge, Table } from '@santi020k/lumen-astro'
---

<Table aria-label="Recent deployments" layout="condensed" scrollCue>
  <table>
    <thead>
      <tr>
        <th class="ui-table__cell--title" scope="col">Service</th>
        <th class="ui-table__cell--secondary" scope="col">Environment</th>
        <th class="ui-table__cell--secondary" scope="col">Region</th>
        <th scope="col">Status</th>
        <th data-numeric="true" scope="col">Duration</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <th class="ui-table__cell--title" scope="row">
          checkout-api
          <span class="ui-table__meta ui-table__narrow"><span>Production</span><span>eu-west-1</span></span>
        </th>
        <td class="ui-table__cell--secondary">Production</td>
        <td class="ui-table__cell--secondary">eu-west-1</td>
        <td><Badge dot variant="success">Live</Badge></td>
        <td data-numeric="true">2m 14s</td>
      </tr>
      <tr>
        <th class="ui-table__cell--title" scope="row">
          search-indexer
          <span class="ui-table__meta ui-table__narrow"><span>Staging</span><span>us-east-1</span></span>
        </th>
        <td class="ui-table__cell--secondary">Staging</td>
        <td class="ui-table__cell--secondary">us-east-1</td>
        <td><Badge dot variant="info">Building</Badge></td>
        <td data-numeric="true">4m 02s</td>
      </tr>
      <tr>
        <th class="ui-table__cell--title" scope="row">
          billing-worker
          <span class="ui-table__meta ui-table__narrow"><span>Production</span><span>us-east-1</span></span>
        </th>
        <td class="ui-table__cell--secondary">Production</td>
        <td class="ui-table__cell--secondary">us-east-1</td>
        <td><Badge dot variant="destructive">Failed</Badge></td>
        <td data-numeric="true">0m 48s</td>
      </tr>
      <tr>
        <th class="ui-table__cell--title" scope="row">
          docs-site
          <span class="ui-table__meta ui-table__narrow"><span>Preview</span><span>eu-west-1</span></span>
        </th>
        <td class="ui-table__cell--secondary">Preview</td>
        <td class="ui-table__cell--secondary">eu-west-1</td>
        <td><Badge dot variant="success">Live</Badge></td>
        <td data-numeric="true">1m 31s</td>
      </tr>
    </tbody>
  </table>
</Table>
Edit Table in browser

Sticky header and totals

stickyHeader keeps column names in view while rows scroll inside the table, up to --ui-table-max-height (32rem by default). data-numeric="true" end-aligns a column with tabular figures, tfoot rows read as totals, and aria-sort on a header shows the order you applied.

AstroCode target · live preview uses Astro
Fictional figures for an example store.
MonthOrdersRevenueRefundsNet
January412$18,540$620$17,920
February388$17,460$540$16,920
March455$20,475$710$19,765
April430$19,350$480$18,870
May472$21,240$690$20,550
June498$22,410$830$21,580
July520$23,400$760$22,640
August505$22,725$650$22,075
September468$21,060$590$20,470
October491$22,095$720$21,375
November563$25,335$940$24,395
December612$27,540$1,080$26,460
Year5,814$261,630$8,610$253,020
View Table code

Framework usage

Switch targets to compare the adapter code. This live preview runs the Astro example. Before copying an example, complete the matching framework setup; React and Elements use their own behavior APIs.Width controls resize the preview container. Resize your browser to test viewport breakpoints.
astro
---
import { Table } from '@santi020k/lumen-astro'
---

<Table
  aria-label="Monthly orders"
  role="region"
  stickyFirstColumn
  stickyHeader
  style="--ui-table-max-height: 18rem"
  tabindex="0"
>
  <table>
    <caption>Fictional figures for an example store.</caption>
    <thead>
      <tr>
        <th aria-sort="ascending" scope="col">Month</th>
        <th data-numeric="true" scope="col">Orders</th>
        <th data-numeric="true" scope="col">Revenue</th>
        <th data-numeric="true" scope="col">Refunds</th>
        <th data-numeric="true" scope="col">Net</th>
      </tr>
    </thead>
    <tbody>
      <tr><th scope="row">January</th><td data-numeric="true">412</td><td data-numeric="true">$18,540</td><td data-numeric="true">$620</td><td data-numeric="true">$17,920</td></tr>
      <tr><th scope="row">February</th><td data-numeric="true">388</td><td data-numeric="true">$17,460</td><td data-numeric="true">$540</td><td data-numeric="true">$16,920</td></tr>
      <tr><th scope="row">March</th><td data-numeric="true">455</td><td data-numeric="true">$20,475</td><td data-numeric="true">$710</td><td data-numeric="true">$19,765</td></tr>
      <tr><th scope="row">April</th><td data-numeric="true">430</td><td data-numeric="true">$19,350</td><td data-numeric="true">$480</td><td data-numeric="true">$18,870</td></tr>
      <tr><th scope="row">May</th><td data-numeric="true">472</td><td data-numeric="true">$21,240</td><td data-numeric="true">$690</td><td data-numeric="true">$20,550</td></tr>
      <tr><th scope="row">June</th><td data-numeric="true">498</td><td data-numeric="true">$22,410</td><td data-numeric="true">$830</td><td data-numeric="true">$21,580</td></tr>
      <tr><th scope="row">July</th><td data-numeric="true">520</td><td data-numeric="true">$23,400</td><td data-numeric="true">$760</td><td data-numeric="true">$22,640</td></tr>
      <tr><th scope="row">August</th><td data-numeric="true">505</td><td data-numeric="true">$22,725</td><td data-numeric="true">$650</td><td data-numeric="true">$22,075</td></tr>
      <tr><th scope="row">September</th><td data-numeric="true">468</td><td data-numeric="true">$21,060</td><td data-numeric="true">$590</td><td data-numeric="true">$20,470</td></tr>
      <tr><th scope="row">October</th><td data-numeric="true">491</td><td data-numeric="true">$22,095</td><td data-numeric="true">$720</td><td data-numeric="true">$21,375</td></tr>
      <tr><th scope="row">November</th><td data-numeric="true">563</td><td data-numeric="true">$25,335</td><td data-numeric="true">$940</td><td data-numeric="true">$24,395</td></tr>
      <tr><th scope="row">December</th><td data-numeric="true">612</td><td data-numeric="true">$27,540</td><td data-numeric="true">$1,080</td><td data-numeric="true">$26,460</td></tr>
    </tbody>
    <tfoot>
      <tr><th scope="row">Year</th><td data-numeric="true">5,814</td><td data-numeric="true">$261,630</td><td data-numeric="true">$8,610</td><td data-numeric="true">$253,020</td></tr>
    </tfoot>
  </table>
</Table>
Edit Table in browser
02

Choose your target

Add this component

Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.

bash@santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
bashAstro wrapper
lumen add Table

Glass

Add the glass prop to apply the shared blur, saturation, border, and highlight tokens. Glass reads best over vivid content, so place the surface above imagery or color.

AstroCode target · live preview uses Astro
ComponentStatus
TableGlass
DataTableGlass
TreeGridGlass
View Table code

Framework usage

Switch targets to compare the adapter code. This live preview runs the Astro example. Before copying an example, complete the matching framework setup; React and Elements use their own behavior APIs.Width controls resize the preview container. Resize your browser to test viewport breakpoints.
astro
---
import { Table } from '@santi020k/lumen-astro'
---

<div class="docs-glass-demo">
  <Table glass>
    <table>
      <thead><tr><th>Component</th><th>Status</th></tr></thead>
      <tbody>
        <tr><td>Table</td><td>Glass</td></tr>
        <tr><td>DataTable</td><td>Glass</td></tr>
        <tr><td>TreeGrid</td><td>Glass</td></tr>
      </tbody>
    </table>
  </Table>
</div>
Edit Table in browser

API reference

Lumen-specific props and runtime attributes for the Astro primitive. Use the framework differences above and the copyable examples for React composition and Elements attributes; the public adapter types define their supported contracts.

AttributeValuesDefaultDescription
glassboolean | "subtle" | "strong"falseApplies the tokenized liquid-glass surface treatment with backdrop-filter fallbacks; "subtle" and "strong" adjust the fill intensity.
layout"scroll" | "records" | "condensed""scroll"scroll keeps every column and scrolls sideways. records stacks rows into cards, and condensed keeps a table but hides secondary columns, both while the table itself is narrower than 48rem, whatever the viewport. Both read the table's width through a container query, so a table in a shrink-to-fit parent, such as inline-grid or width: max-content, needs a definite width. The stacked records display drops native table semantics, so a records Table restores them: it adds role="table", "rowgroup", "row", "columnheader", "rowheader" and "cell" where none is written, and copies each column header's text into body cells' data-label, which the records CSS shows as the label (colspan and rowspan respected). React and Elements apply this on mount; Astro applies it through the UIPrimitives runtime. Hand-written roles, data-label values and ui-table__label spans are kept; data-label="" hides a cell's label. Dioxus Table still needs roles and label spans written by hand.
stickyHeader / sticky-headerbooleanfalse; true in a React or Dioxus DataTableViewKeeps the header row visible while rows scroll inside the table. The table scrolls vertically once it reaches --ui-table-max-height, so the wrapper becomes a focusable region named "Table" unless you set role, tabindex, aria-label or aria-labelledby. On viewports 40rem wide or narrower (48rem for a records table), and in print, the cap is dropped and the page scrolls instead. A records table that stacks inside a narrow container on a wider screen keeps the cap, because a container cannot query its own width.
--ui-table-max-heightCSS length32remCaps the height of a stickyHeader table. Set it with style or a class on the Table.
stickyFirstColumn / sticky-first-columnbooleanfalseKeeps row identifiers visible during horizontal scrolling. Uses logical positioning for RTL and releases the column in very narrow containers, records layouts, and print. With stickyHeader, the corner header cell stays above both.
scrollCue / scroll-cueboolean | stringfalseWith the scroll and condensed layouts, shows "Scroll horizontally to compare" above the table while it overflows sideways, and makes the wrapper a focusable region named "Table" unless you name it. A string replaces the hint.
ui-table__cell--title, --trailing, --actions, --meta, --wideclass on th or td-Places a column in a stacked records card. title names the record on the first line; without one, a row header is the title. trailing ends that line with an emphasized value, actions holds row controls at its end, meta becomes a muted full-width line under it, and wide takes a full line with its label. Title, trailing, actions and meta cells show no label. In a wide table, title cells read in ink and actions hug the row end.
ui-table__cell--secondary, ui-table__narrowclass on th and td; class in a cell-Mark every cell of a column secondary to hide it while a records or condensed table is narrow. Repeat its value in the title cell inside <span class="ui-table__meta ui-table__narrow">, which only shows while narrow, so the value stays readable.
ui-table__metaclass on an element in a cell-A muted second line, such as an email address under a name. Child spans read as one list with a dot between them.
ui-table__row-linkclass on the a in the title cell-Makes the whole row open the link, while buttons, inputs and other links in the row stay clickable. Use one row link per row and give it the record name as its text. With stickyFirstColumn the pinned cell contains the link, so only the title cell opens it.
data-numeric="true"th and td attribute-End-aligns a numeric column's header and cells with tabular figures. Set it on the th and every td of the column.
aria-sort"ascending" | "descending" on a th-Shows an arrow beside the header text of the column you sorted. The application sorts the rows; DataTable sorts for you.
ui-table__empty, ui-table__skeleton-row, aria-busyclasses and wrapper attribute-Loading and empty rows for an authored table: aria-busy="true" on the wrapper dims rows already shown, rows of class ui-table__skeleton-row in a tbody with aria-hidden="true" hold a text Skeleton per cell, and one cell of class ui-table__empty with a colspan of the column count holds the empty message. DataTable renders both from loading and empty props.
childrencaption, thead, tbody, and tfootrequiredNative table structure inside the styled wrapper. The caption reads as a muted note under the rows, and tfoot rows read as totals under a full divider. Header cells sit on a subtle tint.
class, classNamestring""Merges custom classes with the generated ui-* root classes.
...native attributesHTML attributes-Forwards standard attributes to the root element unless the component consumes them.

Customize Table

Start with semantic theme tokens and a class on the public component. Keep its accessible name, focus treatment, and interaction state intact.

cssScoped theme overrides
.product-table {
  --surface: 0 0% 100%;
  --ink: 220 20% 15%;
  --line: 220 15% 82%;
}

Apply product-table through Astro's class, React's className, or the custom element's class. Verify foreground and background contrast in both schemes.

HookValuesDefaultContract
data-numeric="true"th and td attribute-End-aligns a numeric column's header and cells with tabular figures. Set it on the th and every td of the column.
class, classNamestring""Merges custom classes with the generated ui-* root classes.

Use the documented hooks above and adapter types when targeting component states. Theme guide · Accessibility verification scope


Web docsFull catalog