Data table with a quiet header and row hover.
| Component | Category | Status |
|---|---|---|
| Button | Actions | Stable |
| Dialog | Overlays | Stable |
| Dock | Signature | New |
npx @agents-npm-packages/vibeui add table --dir ./src/components/uiImport
import { Table, THead, TBody, TR, TH, TD } from "@/components/ui/table"Generated from the component's TypeScript types, so it always matches the source. * marks a required prop.
also accepts every TableHTMLAttributes<HTMLTableElement> attribute
No props of its own: it forwards native attributes to the element.
also accepts every HTMLAttributes<HTMLTableSectionElement> attribute
No props of its own: it forwards native attributes to the element.
also accepts every HTMLAttributes<HTMLTableSectionElement> attribute
No props of its own: it forwards native attributes to the element.
also accepts every HTMLAttributes<HTMLTableRowElement> attribute
No props of its own: it forwards native attributes to the element.
also accepts every ThHTMLAttributes<HTMLTableCellElement> attribute
No props of its own: it forwards native attributes to the element.
also accepts every TdHTMLAttributes<HTMLTableCellElement> attribute
No props of its own: it forwards native attributes to the element.
import { cn } from "@/lib/utils";
/** Data table with a quiet header and row hover. */
export function Table({
className,
...props
}: React.TableHTMLAttributes<HTMLTableElement>) {
return (
<div className="w-full overflow-x-auto rounded-lg border border-line bg-surface shadow-quiet">
<table className={cn("w-full text-left text-sm", className)} {...props} />
</div>
);
}
export function THead({
className,
...props
}: React.HTMLAttributes<HTMLTableSectionElement>) {
return (
<thead
className={cn("border-b border-line bg-surface-muted/60", className)}
{...props}
/>
);
}
export function TBody({
className,
...props
}: React.HTMLAttributes<HTMLTableSectionElement>) {
return <tbody className={cn("divide-y divide-line", className)} {...props} />;
}
export function TR({
className,
...props
}: React.HTMLAttributes<HTMLTableRowElement>) {
return (
<tr
className={cn("transition-colors hover:bg-surface-muted/50", className)}
{...props}
/>
);
}
export function TH({
className,
...props
}: React.ThHTMLAttributes<HTMLTableCellElement>) {
return (
<th
className={cn(
"whitespace-nowrap px-4 py-3 text-xs font-medium text-muted",
className,
)}
{...props}
/>
);
}
export function TD({
className,
...props
}: React.TdHTMLAttributes<HTMLTableCellElement>) {
return (
<td className={cn("px-4 py-3.5 text-ink-soft", className)} {...props} />
);
}
Exports Table and 5 more. Peer dependencies: clsx, tailwind-merge.