Skip to content
Nana UI

Table

View .md Download

A composable, accessible data table. Compose it with nana-table-header, nana-table-body, nana-table-footer, nana-table-row, nana-table-head, nana-table-cell and nana-table-caption. Built on the CSS table model + surface tokens, so it lays out natively, scrolls horizontally on small screens, and follows the light/dark theme.

Name Role Status Joined Ada Lovelace Engineer Active 2026-01-04 Alan Turing Researcher Invited 2026-02-11
Terminal window
npm install @nana-tec/ui-components
import "@nana-tec/ui-components/table";
<nana-table variant="striped" hoverable>
<nana-table-header>
<nana-table-row>
<nana-table-head>Name</nana-table-head>
<nana-table-head>Role</nana-table-head>
</nana-table-row>
</nana-table-header>
<nana-table-body>
<nana-table-row>
<nana-table-cell>Ada Lovelace</nana-table-cell>
<nana-table-cell>Engineer</nana-table-cell>
</nana-table-row>
</nana-table-body>
</nana-table>

The variant attribute sets the table’s styling — default, bordered, striped, or minimal. Add hoverable for row hover.

ItemQty Default128 Widgets64 ItemQty Bordered128 Widgets64 ItemQty Striped128 Widgets64 ItemQty Minimal128 Widgets64

The density attribute sets cell padding — compact, normal, or comfortable.

ItemQty Widgets128 Gadgets64

Properties

PropertyAttributeTypeDefaultDescription
densityTableDensity'normal'Cell padding
emptybooleanfalseShow the full-width empty-state placeholder instead of body rows. Provide the message via `slot="empty"`. The header still renders so the columns stay in context. A single `nana-table-cell` can't span columns (CSS tables have no `colspan`), so the placeholder is rendered as a full-width block below the grid.
hoverablebooleanfalseHighlight rows on hover
loadingbooleanfalseReplace the body rows with an animated skeleton loader while data loads. The header stays visible so the layout doesn't jump when the rows arrive.
maxHeightmax-heightstring | undefinedConstrain the body height (e.g. `"24rem"`) so the table scrolls vertically. This is what makes `sticky-header` actually stick.
sizingSizingMode'fill'Column sizing strategy. - `fill`: Table fills the container width; columns auto-size (default). - `content`: Columns size to their intrinsic content; table scrolls horizontally if wider than the container. - `fixed`: Declared column widths are honoured; required for reliable truncation.
skeletonRowsskeleton-rowsnumber4Number of placeholder rows the skeleton loader renders while `loading`.
stickyHeadersticky-headerbooleanfalseKeep the header visible while the body scrolls. Pair with `max-height` so the body actually scrolls.
variantTableVariant'default'Visual style

Events

EventDescription
nana-mode-change

Slots

SlotDescription
(default)Table sections (header, body, footer, caption)
emptyFull-width placeholder shown when `empty` is set (e.g. a "no results" message). Renders below the header, spanning every column.

CSS parts

PartDescription
::part(container)The scroll container
::part(table)The native `<table>` element
::part(cell)A header or body cell
::part(caption)The table caption
::part(skeleton)The skeleton-loader region shown while `loading`
::part(empty)The empty-state region

CSS custom properties

PropertyDescription
--nana-table-border-colorGrid / divider colour
--nana-table-row-hoverRow hover background
--nana-table-stripeZebra-stripe background (striped variant)
--nana-table-header-bgHeader background colour
--nana-table-header-colorHeader text colour
--nana-table-radiusCorner radius of the table's frame. Set to 0 for a flush, full-bleed table.
--nana-table-frameWidth of the frame around the table. Set to 0 to remove it.
EventTypeDescription
nana-mode-changeCustomEvent
SlotDescription
(default)Table sections (header, body, footer, caption)
emptyFull-width placeholder shown when empty is set (e.g. a “no results” message). Renders below the header, spanning every column.
VariableDefaultDescription
--nana-table-border-colorGrid / divider colour
--nana-table-row-hoverRow hover background
--nana-table-stripeZebra-stripe background (striped variant)
--nana-table-header-bgHeader background colour
--nana-table-header-colorHeader text colour
--nana-table-radiusCorner radius of the table’s frame. Set to 0 for a flush, full-bleed table.
--nana-table-frameWidth of the frame around the table. Set to 0 to remove it.
PartDescription
containerThe scroll container
tableThe native <table> element
captionThe table caption
cellA header or body cell
contentThe inner content wrapper
rowThe cells row
toggleThe chevron disclosure button
detail-rowThe detail row wrapper
detailThe full-width detail panel
skeletonThe skeleton-loader region shown while loading
emptyThe empty-state region
  • Keyboard accessible
  • Screen-reader labels
  • Focus-visible states
  • ARIA roles and states
  • WCAG 2.2 AA contrast
Explore Table interactively Every state, prop, and edge case — with live controls — in Storybook.
View in Storybook