shadcn, restyled · @jengacore/table
Table
Mono uppercase headers on muted, hairline rows, `fresh` mint flash, `selected` rows and a compact density.
| Transfer | Payer | Amount | Status |
|---|---|---|---|
| tx_01J9…H3V | Horn Commercial Bank | 12,400.00USD | Committed |
| tx_01J9…W7P | Sahan Mobile Money | 480.50USD | Reserved |
| tx_01J9…N0D | Equity Bank | −9,950.00USD | Aborted |
Install
terminal
npx shadcn@latest add @jengacore/tableWithout the namespace configured: npx shadcn@latest add https://ui.jengacore.com/r/<new-york-v4|base-nova>/table.json
Registry dependencies
Source
components/ui/table.tsx
import * as React from "react"
import { cn } from "@/lib/utils"
/**
* App tables are quiet: mono uppercase headers on `muted`, hairline rows, `accent` hover,
* `secondary` for the selected row. 40px rows; pass `density="compact"` (32px) for queues.
* The forest/mint zebra table is for documents only.
*/
function Table({
className,
density = "default",
...props
}: React.ComponentProps<"table"> & { density?: "default" | "compact" }) {
return (
<div data-slot="table-container" className="relative w-full overflow-x-auto">
<table
data-slot="table"
data-density={density}
className={cn("group/table w-full caption-bottom border-collapse text-[13.5px] leading-5", className)}
{...props}
/>
</div>
)
}
function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
return <thead data-slot="table-header" className={cn("bg-muted", className)} {...props} />
}
function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
return <tbody data-slot="table-body" className={cn("[&_tr:last-child>td]:border-0", className)} {...props} />
}
function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
return <tfoot data-slot="table-footer" className={cn("border-t border-border bg-muted/60 font-medium", className)} {...props} />
}
function TableRow({
className,
fresh,
selected,
...props
}: React.ComponentProps<"tr"> & {
/** Flash mint when the row arrives live (2.4 s). */
fresh?: boolean
selected?: boolean
}) {
return (
<tr
data-slot="table-row"
data-state={selected ? "selected" : undefined}
className={cn(
"transition-colors duration-fast ease-jc hover:[&>td]:bg-accent data-[state=selected]:[&>td]:bg-secondary",
fresh && "[&>td]:animate-flash",
className
)}
{...props}
/>
)
}
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
return (
<th
data-slot="table-head"
className={cn(
"h-9 border-b border-border px-3 text-left align-middle font-mono text-[10.5px] leading-4 font-medium tracking-[0.1em] whitespace-nowrap text-muted-foreground uppercase group-data-[density=compact]/table:h-8 [&:has([role=checkbox])]:pr-0",
className
)}
{...props}
/>
)
}
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
return (
<td
data-slot="table-cell"
className={cn(
"h-10 border-b border-border px-3 align-middle whitespace-nowrap tabular-nums group-data-[density=compact]/table:h-8 [&:has([role=checkbox])]:pr-0",
className
)}
{...props}
/>
)
}
function TableCaption({ className, ...props }: React.ComponentProps<"caption">) {
return <caption data-slot="table-caption" className={cn("mt-3 text-[13px] text-muted-foreground", className)} {...props} />
}
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption }