Table
A semantic HTML table for invoices, admin lists, and pricing grids — bordered rows, bold headers, and a hard neobrutalist shadow.
import {
Table,
TableBody,The table styles the native HTML table elements — <table>, <thead>, <tbody>, <th>, <td>, <caption> — with no primitive library underneath; the Radix and Base variants ship the same file. The neobrutalist recipe: a thick border and hard shadow around the whole table, heading-font header cells, and 2px row dividers.
Reach for it when:
- Invoices and orders — line items with a
TableFooterrow for the total. - Admin lists — users, API keys, subscriptions, with a dropdown of row actions.
- Pricing and comparison grids — feature matrices where the column headers carry the meaning.
Installation#
pnpm dlx shadcn@latest add https://neobrutalism.com/r/base/table.jsonnpx shadcn@latest add https://neobrutalism.com/r/base/table.jsonyarn dlx shadcn@latest add https://neobrutalism.com/r/base/table.jsonbunx --bun shadcn@latest add https://neobrutalism.com/r/base/table.json
Copy and paste the following code into your project.
"use client"
import * as React from "react"
import { cn } from "@/lib/utils"
function Table({ className, ...props }: React.ComponentProps<"table">) {
return (
<div
data-slot="table-container"
className="relative w-full overflow-x-auto rounded border-2 shadow-md"
>
<table
data-slot="table"
className={cn("w-full caption-bottom text-sm", className)}
{...props}
/>
</div>
)
}
function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
return (
<thead
data-slot="table-header"
className={cn("[&_tr]:border-b-2", className)}
{...props}
/>
)
}
function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
return (
<tbody
data-slot="table-body"
className={cn("[&_tr:last-child]:border-0", className)}
{...props}
/>
)
}
function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
return (
<tfoot
data-slot="table-footer"
className={cn(
"border-t-2 bg-muted/50 font-medium [&>tr]:last:border-b-0",
className
)}
{...props}
/>
)
}
function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
return (
<tr
data-slot="table-row"
className={cn(
"border-b-2 transition-colors hover:bg-accent has-aria-expanded:bg-accent data-[state=selected]:bg-accent",
className
)}
{...props}
/>
)
}
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
return (
<th
data-slot="table-head"
className={cn(
"h-10 bg-muted px-2 text-left align-middle font-head font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",
className
)}
{...props}
/>
)
}
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
return (
<td
data-slot="table-cell"
className={cn(
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",
className
)}
{...props}
/>
)
}
function TableCaption({
className,
...props
}: React.ComponentProps<"caption">) {
return (
<caption
data-slot="table-caption"
className={cn("mt-4 text-sm text-muted-foreground", className)}
{...props}
/>
)
}
export {
Table,
TableHeader,
TableBody,
TableFooter,
TableHead,
TableRow,
TableCell,
TableCaption,
}
Update the import paths to match your project setup.
Usage#
import {
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table"<Table>
<TableCaption>A list of your recent invoices.</TableCaption>
<TableHeader>
<TableRow>
<TableHead className="w-[100px]">Invoice</TableHead>
<TableHead>Status</TableHead>
<TableHead>Method</TableHead>
<TableHead className="text-right">Amount</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell className="font-medium">INV001</TableCell>
<TableCell>Paid</TableCell>
<TableCell>Credit Card</TableCell>
<TableCell className="text-right">$250.00</TableCell>
</TableRow>
</TableBody>
</Table>Composition#
Use the following composition to build a Table:
Table
├── TableCaption
├── TableHeader
│ └── TableRow
│ ├── TableHead
│ ├── TableHead
│ ├── TableHead
│ └── TableHead
├── TableBody
│ ├── TableRow
│ │ ├── TableCell
│ │ ├── TableCell
│ │ ├── TableCell
│ │ └── TableCell
│ └── TableRow
│ ├── TableCell
│ ├── TableCell
│ ├── TableCell
│ └── TableCell
└── TableFooterExamples#
Footer#
Use the <TableFooter /> component to add a footer to the table.
import {
Table,
TableBody,Actions#
A table showing actions for each row using a <DropdownMenu /> component.
import { MoreHorizontalIcon } from "lucide-react"
import { Button } from "@/components/ui/button"Data Table#
You can use the <Table /> component to build more complex data tables. Combine it with @tanstack/react-table to create tables with sorting, filtering and pagination.
See the Data Table documentation for more information.
You can also see an example of a data table in the Tasks demo.
RTL#
To enable RTL support in Neobrutalism.com, see the RTL configuration guide.
"use client"
import * as React from "react"Accessibility#
Rendering native table elements gives screen readers table announcement, row/column navigation, and header association with no ARIA wiring. Name each table with TableCaption and reserve TableHead for genuine header cells. The scroll container isn't focusable, so keyboard-only users can't scroll a table that overflows — if wide tables are likely, add tabIndex={0}, role="region", and an aria-label to the container div in your copy of the component.