NovaUI
Components

Table

A structured data display component with rows, columns, headers, and optional footer and caption.

The Table component displays structured data in rows and columns. It supports horizontal scrolling for wide tables, a compound component API with header, body, footer, and caption parts, and is styled with NativeWind for consistent appearance across platforms.

Preview

Invoice
Status
Amount
INV001
Paid
$250.00
INV002
Pending
$150.00
INV003
Unpaid
$350.00
Total
$750.00

Installation

npx novaui-cli add table

Import

import {
  Table,
  TableHeader,
  TableBody,
  TableFooter,
  TableHead,
  TableRow,
  TableCell,
  TableCaption,
} from 'novaui-components'

Basic Usage

The Table is a compound component with these parts:

  • Table - Root container with horizontal scroll support
  • TableHeader - Container for header rows
  • TableBody - Container for data rows
  • TableFooter - Optional footer row (e.g. totals)
  • TableRow - A single row
  • TableHead - Header cell with muted styling
  • TableCell - Data cell
  • TableCaption - Optional caption below the table
Invoice
Status
Amount
INV001
Paid
$250.00
INV002
Pending
$150.00
import {
  Table,
  TableHeader,
  TableBody,
  TableRow,
  TableHead,
  TableCell,
} from 'novaui-components'

const invoices = [
  { id: 'INV001', status: 'Paid', amount: '$250.00' },
  { id: 'INV002', status: 'Pending', amount: '$150.00' },
]

export function BasicTable() {
  return (
    <Table>
      <TableHeader>
        <TableRow>
          <TableHead>Invoice</TableHead>
          <TableHead>Status</TableHead>
          <TableHead className="text-right">Amount</TableHead>
        </TableRow>
      </TableHeader>
      <TableBody>
        {invoices.map((invoice) => (
          <TableRow key={invoice.id}>
            <TableCell className="font-medium">{invoice.id}</TableCell>
            <TableCell>{invoice.status}</TableCell>
            <TableCell className="text-right">{invoice.amount}</TableCell>
          </TableRow>
        ))}
      </TableBody>
    </Table>
  )
}

Add a footer row for totals or summaries:

Item
Price
Design System
$99.00
Component Library
$149.00
Total
$248.00
<Table>
  <TableHeader>
    <TableRow>
      <TableHead>Item</TableHead>
      <TableHead className="text-right">Price</TableHead>
    </TableRow>
  </TableHeader>
  <TableBody>
    <TableRow>
      <TableCell>Design System</TableCell>
      <TableCell className="text-right">$99.00</TableCell>
    </TableRow>
    <TableRow>
      <TableCell>Component Library</TableCell>
      <TableCell className="text-right">$149.00</TableCell>
    </TableRow>
  </TableBody>
  <TableFooter>
    <TableRow>
      <TableCell className="font-medium">Total</TableCell>
      <TableCell className="text-right font-medium">$248.00</TableCell>
    </TableRow>
  </TableFooter>
</Table>

With Caption

Add a descriptive caption to the table:

<Table>
  <TableCaption>A list of recent invoices.</TableCaption>
  <TableHeader>
    <TableRow>
      <TableHead>Invoice</TableHead>
      <TableHead>Status</TableHead>
      <TableHead className="text-right">Amount</TableHead>
    </TableRow>
  </TableHeader>
  <TableBody>
    <TableRow>
      <TableCell className="font-medium">INV001</TableCell>
      <TableCell>Paid</TableCell>
      <TableCell className="text-right">$250.00</TableCell>
    </TableRow>
  </TableBody>
</Table>

Props API

Table Props

Extends React.ComponentPropsWithoutRef<typeof View>:

PropTypeDefaultDescription
classNamestring-Additional CSS classes

The Table wraps content in a horizontal ScrollView for wide table support.

TableHeader Props

Extends React.ComponentPropsWithoutRef<typeof View>:

PropTypeDefaultDescription
classNamestring-Additional CSS classes

TableBody Props

Extends React.ComponentPropsWithoutRef<typeof View>:

PropTypeDefaultDescription
classNamestring-Additional CSS classes

TableFooter Props

Extends React.ComponentPropsWithoutRef<typeof View>:

PropTypeDefaultDescription
classNamestring-Additional CSS classes

TableRow Props

Extends React.ComponentPropsWithoutRef<typeof Pressable>:

PropTypeDefaultDescription
classNamestring-Additional CSS classes

Rows use Pressable and support active:bg-muted/50 for press feedback.

TableHead Props

Extends React.ComponentPropsWithoutRef<typeof View>:

PropTypeDefaultDescription
classNamestring-Additional CSS classes. Use text-right or text-center for alignment.

TableCell Props

Extends React.ComponentPropsWithoutRef<typeof View>:

PropTypeDefaultDescription
classNamestring-Additional CSS classes. Use text-right or text-center for alignment.

TableCaption Props

Extends React.ComponentPropsWithoutRef<typeof View>:

PropTypeDefaultDescription
classNamestring-Additional CSS classes

Best Practices

  1. Use flex-row for columns: Each TableRow uses flex-row — give cells flex-1 or fixed widths for consistent columns

  2. Right-align numbers: Use className="text-right" on TableHead and TableCell for numeric columns

  3. Footer for totals: Use TableFooter for sum rows — it has bg-muted/50 background to distinguish from data

  4. Horizontal scroll: The Table component wraps in a horizontal ScrollView — wide tables scroll naturally on small screens

  5. Caption for context: Add TableCaption when the table needs a descriptive label

  • Use Card to wrap tables for a bordered container look
  • Use Pagination below tables for paginated data sets
  • Use Skeleton for table loading states

On this page