Skip to Content
glob.ui home
Components

Table

Styled native table parts: header, body, footer, rows and cells, with density, striped rows, a sticky header and right-aligned numbers.

Server componentNo state or handlers. Safe to render in a Server Component.
import { Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption } from "@glob-ui/table"

Preview

Invoices, November
InvoiceClientAmount
INV-1001Atlas Studio$1,240.00
INV-1002Northwind$860.00
INV-1003Bluebird Labs$2,310.00
Total$4,410.00

Examples

Density

density is compact, default or comfortable: the cell padding of the whole table.

compact

NameRole
AnaAdmin
BenitoEditor
DaraViewer

default

NameRole
AnaAdmin
BenitoEditor
DaraViewer

comfortable

NameRole
AnaAdmin
BenitoEditor
DaraViewer

stickyHeader keeps the header in view. The table scrolls inside its wrapper, so give the wrapper a height with containerClassName.

OrderStatus
ORD-2000Shipped
ORD-2001Pending
ORD-2002Pending
ORD-2003Shipped
ORD-2004Pending
ORD-2005Pending
ORD-2006Shipped
ORD-2007Pending
ORD-2008Pending
ORD-2009Shipped
ORD-2010Pending
ORD-2011Pending
ORD-2012Shipped
ORD-2013Pending
ORD-2014Pending
ORD-2015Shipped
ORD-2016Pending
ORD-2017Pending
ORD-2018Shipped
ORD-2019Pending
ORD-2020Pending
ORD-2021Shipped
ORD-2022Pending
ORD-2023Pending
ORD-2024Shipped
ORD-2025Pending
ORD-2026Pending
ORD-2027Shipped
ORD-2028Pending
ORD-2029Pending

The table owns its scroll

A table wider than its container scrolls inside its own wrapper, never the page. This is the rule for every layout: the page does not handle horizontal scroll. Give a long table a containerClassName with a height when you also want a sticky header.

API

Props are generated from the TypeScript types in the package source.

Table

Prop

Type

TableHead

Prop

Type

TableCell

Prop

Type

Accessibility

Key or actionBehaviour
Scroll region (scrollLabel)The wrapper becomes role="region", named by scrollLabel, and focusable, so keyboard users can scroll a wide table with the arrow keys. Use it when the table can be wider than the screen.
CaptionTableCaption names the table for screen readers and is shown under it.
Row selectiondata-state="selected" shades the row. Pair it with a checkbox in a cell for a selectable table.

ARIA. Uses the native table elements, so screen readers announce the row and column headers. align only changes the text alignment, not the reading order.

On this page