Table
Semantic table primitives styled by the theme. For sorting, search and paging use DataTable.
Status: stable. Category: Data display.
import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell } from '@glyphui/ui'
Exports: Table, TableHeader, TableBody, TableRow, TableHead, TableCell, TableCaption, tableStyles.
Notes
- The table scrolls horizontally inside its wrapper instead of widening the page.
Example: Basic
import { Badge, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@glyphui/ui'
const members = [
{ name: 'Ada Lovelace', email: '[email protected]', role: 'Owner' },
{ name: 'Grace Hopper', email: '[email protected]', role: 'Admin' },
{ name: 'Alan Kay', email: '[email protected]', role: 'Member' },
]
export default function Example() {
return (
<Table>
<TableHeader>
<TableRow>
<TableHead>Name</TableHead>
<TableHead>Email</TableHead>
<TableHead>Role</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{members.map((m) => (
<TableRow key={m.email}>
<TableCell className="font-medium">{m.name}</TableCell>
<TableCell className="text-muted-foreground">{m.email}</TableCell>
<TableCell>
<Badge>{m.role}</Badge>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
)
}
Example: Numeric columns
Figures are tabular by default, so digits line up.
import {
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@glyphui/ui'
const invoices = [
{ id: 'INV-1042', date: 'Oct 2', amount: 1240.0 },
{ id: 'INV-1043', date: 'Oct 9', amount: 86.5 },
{ id: 'INV-1044', date: 'Oct 14', amount: 12900.75 },
]
const usd = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' })
export default function Example() {
return (
<Table>
<TableCaption>Invoices for October 2026</TableCaption>
<TableHeader>
<TableRow>
<TableHead>Invoice</TableHead>
<TableHead>Date</TableHead>
<TableHead className="text-right">Amount</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{invoices.map((inv) => (
<TableRow key={inv.id}>
<TableCell className="font-mono text-caption">{inv.id}</TableCell>
<TableCell>{inv.date}</TableCell>
<TableCell className="text-right">{usd.format(inv.amount)}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
)
}
Live page: https://glyphui.xyz/components/table