Skip to main content
161

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
Data displayGlass surface

DataTable

Styles dense tabular data and records.

FrameworksAstro · React · Elements

Registry commandlumen add DataTable

InteractionEnhanced runtime

01

See it and copy it

Framework example

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

AstroSame visual contract, native framework API

0 selected

PackageTargetDownloads
@santi020k/lumen-astroAstro24,800
@santi020k/lumen-reactReact8,450
@santi020k/lumen-elementsCustom elements5,120

Framework usage

Switch targets to compare the adapter code. The preview stays visually stable because all three packages share the same tokens and ui-* class contract.
astro
---
import {
  DataTable
} from '@santi020k/lumen-astro'

const columns: {
  header: string
  key: string
  sort?: 'number' | 'string'
  sortable?: boolean
}[] = [
  { header: 'Package', key: 'package', sortable: true },
  { header: 'Target', key: 'target' },
  { header: 'Downloads', key: 'downloads', sort: 'number', sortable: true }
]

const rows = [
  {
    downloads: { label: '24,800', sortValue: 24800 },
    package: '@santi020k/lumen-astro',
    rowValue: 'astro',
    target: 'Astro'
  },
  {
    downloads: { label: '8,450', sortValue: 8450 },
    package: '@santi020k/lumen-react',
    rowValue: 'react',
    target: 'React'
  },
  {
    downloads: { label: '5,120', sortValue: 5120 },
    package: '@santi020k/lumen-elements',
    rowValue: 'elements',
    target: 'Custom elements'
  }
]
---

<div class="docs-example-stack" data-data-table-example>
  <p aria-live="polite">
    <strong data-selected-count>0</strong> selected
  </p>

  <DataTable id="ex-datatable" columns={columns} name="packages" rows={rows} selectable />
</div>

<script>
  const table = document.getElementById('ex-datatable')
  const count = document.querySelector('[data-selected-count]')

  table?.addEventListener('ui:data-table-selection-change', event => {
    const detail = (event as CustomEvent<{ values: string[] }>).detail

    if (count) count.textContent = String(detail.values.length)
  })
</script>
Edit DataTable 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
pnpm add @santi020k/lumen-astro
bashAstro wrapper
lumen add DataTable
lumen add DataTable

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.

AstroSame visual contract, native framework API
PackageRuntimeGlass
@santi020k/lumen-astroAstroSupported
@santi020k/lumen-reactReactSupported
@santi020k/lumen-elementsWeb ComponentsSupported

Framework usage

Switch targets to compare the adapter code. The preview stays visually stable because all three packages share the same tokens and ui-* class contract.
astro
---
import { DataTable } from '@santi020k/lumen-astro'
---

<div class="docs-glass-demo">
  <DataTable glass>
    <table>
      <thead><tr><th>Package</th><th>Runtime</th><th>Glass</th></tr></thead>
      <tbody>
        <tr><td>@santi020k/lumen-astro</td><td>Astro</td><td>Supported</td></tr>
        <tr><td>@santi020k/lumen-react</td><td>React</td><td>Supported</td></tr>
        <tr><td>@santi020k/lumen-elements</td><td>Web Components</td><td>Supported</td></tr>
      </tbody>
    </table>
  </DataTable>
</div>
Edit DataTable in browser

API reference

Lumen-specific props and runtime attributes for the Astro primitive. React props follow the same names; Elements use equivalent kebab-case attributes where custom elements expose them.

AttributeValuesDefaultDescription
glassboolean | "subtle" | "strong"falseApplies the tokenized liquid-glass surface treatment with backdrop-filter fallbacks; "subtle" and "strong" adjust the fill intensity.
columnsDataTableColumn[][]Generates table headers and maps row cells by column key when rows are provided.
rowsDataTableRow[][]Generates table body rows from structured data.
namestring-Scopes selectable row checkbox names for form submission and runtime selection state.
selectablebooleanfalseEnables selectable row behavior for the UIPrimitives runtime.
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.

Runtime events

CustomEvents dispatched by the Astro UIPrimitives runtime for this component.

EventTargetDetailWhen
ui:data-table-selection-changeDataTable root ([data-ui-datatable]){ values: string[] }Fires after a selectable DataTable row checkbox, select-all checkbox, or form reset changes the selected row values.

Web docsFull catalog