Uqudo UIregistry

Table

A responsive table component.

A list of your recent invoices.
InvoiceStatusMethodAmount
INV001PaidCredit card$250.00
INV002PendingPayPal$150.00
INV003UnpaidBank transfer$350.00
INV004PaidCredit card$450.00
INV005PaidPayPal$550.00
Total$1,750.00

Installation

npx shadcn@latest add @uqudo/table

Usage

import {
  Table,
  TableBody,
  TableCaption,
  TableCell,
  TableFooter,
  TableHead,
  TableHeader,
  TableRow,
} from "@/components/uqudo/ui/table"
<Table>
  <TableCaption>A list of your recent invoices.</TableCaption>
  <TableHeader>
    <TableRow>
      <TableHead>Invoice</TableHead>
      <TableHead>Status</TableHead>
    </TableRow>
  </TableHeader>
  <TableBody>
    <TableRow>
      <TableCell>INV001</TableCell>
      <TableCell>Paid</TableCell>
    </TableRow>
  </TableBody>
</Table>

Each component is a thin wrapper around the matching HTML element, so anything you know about <table> applies: colSpan, scope, align, event handlers and so on pass straight through.

Table wraps the <table> in a div with data-slot="table-container" and overflow-x-auto, so a wide table scrolls horizontally inside its parent instead of breaking the page layout. Constrain the width of that parent, not the table itself.

API Reference

Every component forwards className (merged through cn()) and all other props of the element it renders.

ComponentRendersNotes
Table<table>Wrapped in a scrollable div with data-slot="table-container".
TableHeader<thead>Adds a bottom border to its rows.
TableBody<tbody>Removes the border of the last row.
TableFooter<tfoot>Muted background, medium font weight, top border.
TableRow<tr>Highlights on hover and when data-state="selected" is set.
TableHead<th>Start-aligned, medium weight header cell. Trims end padding when it contains a checkbox.
TableCell<td>Standard cell. Trims end padding when it contains a checkbox.
TableCaption<caption>Rendered below the table in muted text.

Table

Prop

Type

TableRow

Prop

Type

Data attributes

AttributeValue
data-slottable-container, table, table-header, table-body, table-footer, table-row, table-head, table-cell or table-caption.

On this page