Components
Table
Rows of the same kind of thing, such as roles or applications, compared column by column.
| Role | Location | Salary | Applied |
|---|---|---|---|
| InnoWavePrincipal Software Engineer | Manchester | £130,000 | 23 Feb 2026 |
| QuantumLeapStaff Software Engineer | London | Up to £136,000 | 21 Feb 2026 |
| NextGen RoboticsLead Frontend Engineer | London | £130,000–140,000 | 18 Feb 2026 |
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@dex/shared/components/table'
const APPLICATIONS = [
{
company: 'InnoWave',
role: 'Principal Software Engineer',
location: 'Manchester',
salary: '£130,000',
applied: '23 Feb 2026',
},
{
company: 'QuantumLeap',
role: 'Staff Software Engineer',
location: 'London',
salary: 'Up to £136,000',
applied: '21 Feb 2026',
},
{
company: 'NextGen Robotics',
role: 'Lead Frontend Engineer',
location: 'London',
salary: '£130,000–140,000',
applied: '18 Feb 2026',
},
]
export function TableDefault() {
return (
<Table>
<TableHeader>
<TableRow>
<TableHead>Role</TableHead>
<TableHead>Location</TableHead>
<TableHead>Salary</TableHead>
<TableHead>Applied</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{APPLICATIONS.map((application) => (
<TableRow key={application.company}>
<TableCell>
<span className="font-bold">{application.company}</span>
<span className="block text-xs text-muted-foreground">{application.role}</span>
</TableCell>
<TableCell>{application.location}</TableCell>
<TableCell>{application.salary}</TableCell>
<TableCell>{application.applied}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
)
}
| Offer | Amount |
|---|---|
| Base salary | £135,000 |
| Bonus | £13,500 |
| Equity, per year | £20,000 |
| Total | £168,500 |
import {
Table,
TableBody,
TableCell,
TableFooter,
TableHead,
TableHeader,
TableRow,
} from '@dex/shared/components/table'
const OFFER = [
{ part: 'Base salary', amount: '£135,000' },
{ part: 'Bonus', amount: '£13,500' },
{ part: 'Equity, per year', amount: '£20,000' },
]
export function TableWithFooter() {
return (
<div className="w-full max-w-md">
<Table>
<TableHeader>
<TableRow>
<TableHead>Offer</TableHead>
<TableHead className="text-right">Amount</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{OFFER.map((row) => (
<TableRow key={row.part}>
<TableCell>{row.part}</TableCell>
<TableCell className="text-right tabular-nums">{row.amount}</TableCell>
</TableRow>
))}
</TableBody>
<TableFooter>
<TableRow>
<TableCell>Total</TableCell>
<TableCell className="text-right tabular-nums">£168,500</TableCell>
</TableRow>
</TableFooter>
</Table>
</div>
)
}
| Stage | Date | Length |
|---|---|---|
| Intro call | 2 Mar 2026 | 30 minutes |
| System design | 9 Mar 2026 | 1 hour |
| Team day | 16 Mar 2026 | 4 hours |
import {
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@dex/shared/components/table'
const INTERVIEWS = [
{ stage: 'Intro call', date: '2 Mar 2026', length: '30 minutes' },
{ stage: 'System design', date: '9 Mar 2026', length: '1 hour' },
{ stage: 'Team day', date: '16 Mar 2026', length: '4 hours' },
]
export function TableWithCaption() {
return (
<div className="w-full max-w-md">
<Table>
<TableCaption>Interviews with QuantumLeap</TableCaption>
<TableHeader>
<TableRow>
<TableHead>Stage</TableHead>
<TableHead>Date</TableHead>
<TableHead>Length</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{INTERVIEWS.map((interview) => (
<TableRow key={interview.stage}>
<TableCell>{interview.stage}</TableCell>
<TableCell>{interview.date}</TableCell>
<TableCell>{interview.length}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
)
}
| Company | Stage | |
|---|---|---|
| InnoWave | Applied | 23 Feb 2026 |
| QuantumLeap | Interviewing | 21 Feb 2026 |
| NextGen Robotics | Offer | 18 Feb 2026 |
'use client'
import { ArrowDown, ArrowUp } from 'lucide-react'
import { useState } from 'react'
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@dex/shared/components/table'
import { formatDate } from '@dex/shared/utils/date-formats'
const APPLICATIONS = [
{ company: 'InnoWave', stage: 'Applied', applied: '2026-02-23' },
{ company: 'QuantumLeap', stage: 'Interviewing', applied: '2026-02-21' },
{ company: 'NextGen Robotics', stage: 'Offer', applied: '2026-02-18' },
]
export function TableSortable() {
const [isNewestFirst, setIsNewestFirst] = useState(true)
const rows = APPLICATIONS.toSorted((a, b) =>
isNewestFirst ? b.applied.localeCompare(a.applied) : a.applied.localeCompare(b.applied),
)
const Arrow = isNewestFirst ? ArrowDown : ArrowUp
return (
<div className="w-full max-w-md">
<Table>
<TableHeader>
<TableRow>
<TableHead>Company</TableHead>
<TableHead>Stage</TableHead>
<TableHead aria-sort={isNewestFirst ? 'descending' : 'ascending'}>
<button
type="button"
className="flex cursor-pointer items-center gap-1"
onClick={() => setIsNewestFirst((newest) => !newest)}
>
Applied
<Arrow className="size-4 text-muted-foreground" aria-hidden />
</button>
</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{rows.map((row) => (
<TableRow key={row.company}>
<TableCell className="font-bold">{row.company}</TableCell>
<TableCell>{row.stage}</TableCell>
<TableCell>{formatDate(row.applied)}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
)
}
| Company | Role | Actions |
|---|---|---|
| InnoWave | Principal Software Engineer | |
| QuantumLeap | Staff Software Engineer | |
| NextGen Robotics | Lead Frontend Engineer |
import { Ellipsis } from 'lucide-react'
import { Button } from '@dex/shared/components/button'
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from '@dex/shared/components/dropdown-menu'
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@dex/shared/components/table'
const ROLES = [
{ company: 'InnoWave', role: 'Principal Software Engineer' },
{ company: 'QuantumLeap', role: 'Staff Software Engineer' },
{ company: 'NextGen Robotics', role: 'Lead Frontend Engineer' },
]
export function TableRowActions() {
return (
<div className="w-full max-w-lg">
<Table>
<TableHeader>
<TableRow>
<TableHead>Company</TableHead>
<TableHead>Role</TableHead>
<TableHead>
<span className="sr-only">Actions</span>
</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{ROLES.map((row) => (
<TableRow key={row.company}>
<TableCell className="font-bold">{row.company}</TableCell>
<TableCell>{row.role}</TableCell>
<TableCell className="text-right">
<DropdownMenu>
<DropdownMenuTrigger
render={
<Button
variant="ghost"
size="icon"
aria-label={`Actions for ${row.company}`}
/>
}
>
<Ellipsis />
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem>View role</DropdownMenuItem>
<DropdownMenuItem>Save for later</DropdownMenuItem>
<DropdownMenuItem variant="destructive">Withdraw application</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
)
}
| Company | Role | Location | Salary | Notice period |
|---|---|---|---|---|
| InnoWave | Principal Software Engineer | Manchester | £130,000 | 3 months |
| QuantumLeap | Staff Software Engineer | London | Up to £136,000 | 1 month |
| NextGen Robotics | Lead Frontend Engineer | London | £130,000–140,000 | 2 months |
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@dex/shared/components/table'
const ROLES = [
{
company: 'InnoWave',
role: 'Principal Software Engineer',
location: 'Manchester',
salary: '£130,000',
notice: '3 months',
},
{
company: 'QuantumLeap',
role: 'Staff Software Engineer',
location: 'London',
salary: 'Up to £136,000',
notice: '1 month',
},
{
company: 'NextGen Robotics',
role: 'Lead Frontend Engineer',
location: 'London',
salary: '£130,000–140,000',
notice: '2 months',
},
]
export function TableWide() {
return (
<div className="w-full max-w-sm">
<Table>
<TableHeader>
<TableRow>
<TableHead>Company</TableHead>
<TableHead>Role</TableHead>
<TableHead>Location</TableHead>
<TableHead>Salary</TableHead>
<TableHead>Notice period</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{ROLES.map((row) => (
<TableRow key={row.company}>
<TableCell className="font-bold">{row.company}</TableCell>
<TableCell>{row.role}</TableCell>
<TableCell>{row.location}</TableCell>
<TableCell>{row.salary}</TableCell>
<TableCell>{row.notice}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
)
}
| Role | Company | Location | Salary |
|---|---|---|---|
| Principal Software Engineer | InnoWave | Manchester | £130,000 |
| Staff Software Engineer | QuantumLeap | London | £136,000 |
| Lead Frontend Engineer | NextGen Robotics | London | £140,000 |
| Senior Backend Engineer | InnoWave | Remote | £115,000 |
| Machine Learning Engineer | QuantumLeap | Cambridge | £125,000 |
| Senior Platform Engineer | NextGen Robotics | Bristol | £110,000 |
| Engineering Manager | InnoWave | Manchester | £145,000 |
| Senior Data Engineer | QuantumLeap | London | £120,000 |
| Staff Product Engineer | NextGen Robotics | Remote | £135,000 |
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@dex/shared/components/table'
const ROLES = [
{
role: 'Principal Software Engineer',
company: 'InnoWave',
location: 'Manchester',
salary: '£130,000',
},
{
role: 'Staff Software Engineer',
company: 'QuantumLeap',
location: 'London',
salary: '£136,000',
},
{
role: 'Lead Frontend Engineer',
company: 'NextGen Robotics',
location: 'London',
salary: '£140,000',
},
{ role: 'Senior Backend Engineer', company: 'InnoWave', location: 'Remote', salary: '£115,000' },
{
role: 'Machine Learning Engineer',
company: 'QuantumLeap',
location: 'Cambridge',
salary: '£125,000',
},
{
role: 'Senior Platform Engineer',
company: 'NextGen Robotics',
location: 'Bristol',
salary: '£110,000',
},
{ role: 'Engineering Manager', company: 'InnoWave', location: 'Manchester', salary: '£145,000' },
{ role: 'Senior Data Engineer', company: 'QuantumLeap', location: 'London', salary: '£120,000' },
{
role: 'Staff Product Engineer',
company: 'NextGen Robotics',
location: 'Remote',
salary: '£135,000',
},
]
// The box stands in for the page: it scrolls, and the header sticks to its top.
export function TablePlain() {
return (
<div className="max-h-72 w-full overflow-y-auto">
<Table variant="plain">
<TableHeader sticky>
<TableRow className="hover:bg-transparent">
<TableHead>Role</TableHead>
<TableHead>Company</TableHead>
<TableHead>Location</TableHead>
<TableHead>Salary</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{ROLES.map((role) => (
<TableRow key={`${role.company}-${role.role}`}>
<TableCell className="font-bold">{role.role}</TableCell>
<TableCell className="text-muted-foreground">{role.company}</TableCell>
<TableCell className="text-muted-foreground">{role.location}</TableCell>
<TableCell className="text-muted-foreground tabular-nums">{role.salary}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
)
}
Tabledraws its own card: the border, the rounded corners and thebg-cardfill. Do not wrap it in another card.- A table wider than its space scrolls sideways inside the card, and the cut-off edge fades. Cells do not wrap, so keep each cell short and put a second line in a
blockspan. - Use
variant="plain"when the page is the table, such as a list of every role in an internal tool: dense rows, no card and no lines between rows, and the page scrolls it. A row takes a rounded tint when it is pointed at, open or selected. Give its headerstickyso the column names stay in view. - Leave room either side of a plain table that runs the width of its page, so a row's tint stops short of the edge, and pad the first and last cells to put their text on the page's gutter.
- A stuck header covers the rows passing under it and draws a hairline under itself, only while they do. The line runs the full width of whatever scrolls the table, like the line under any other header, and it is not a shadow.
- Every one-line row of a plain table is 44px high, whatever sits in it, so one page of rows is as tall as the next.
- Put the main thing in the first column in bold, with its detail under it in small muted text.