Table

A simple table component for displaying tabular data.

A list of current projects.
ProjectStatusTeamBudget
Website RedesignPaidFrontend Team$12,500
Mobile AppUnpaidMobile Team$8,750
API IntegrationPendingBackend Team$5,200
Database MigrationPaidDevOps Team$3,800
User DashboardPaidUX Team$7,200
Security AuditFailedSecurity Team$2,100
Total Budget$39,550

Overview

Use Table for structured data arranged in rows and columns.

Tables are useful for invoices, users, orders, logs, permissions, metrics, and any data where users compare values across rows.

Anatomy

A table has a caption or surrounding heading, header rows, body rows, cells, and optional footer. Headers should describe the data in each column.

Usage guidance

Use tables for comparison. Use cards or lists when each item has varied content and users do not need column alignment.

Accessibility

Use table headers correctly so screen readers can understand row and column relationships. Keep action buttons inside rows clearly labeled.

Installation

npm
npx love-ui@latest add table

Usage

import {
  Table,
  TableBody,
  TableCaption,
  TableCell,
  TableFooter,
  TableHead,
  TableHeader,
  TableRow,
} from "@/components/ui/table"
<Table>
  <TableCaption>Caption</TableCaption>
  <TableHeader>
    <TableRow>
      <TableHead>Header</TableHead>
      <TableHead>Header</TableHead>
    </TableRow>
  </TableHeader>
  <TableBody>
    <TableRow>
      <TableCell>Cell</TableCell>
      <TableCell>Cell</TableCell>
    </TableRow>
  </TableBody>
</Table>

Examples

The examples show a basic table and a framed table surface.

Framed Table

ProjectStatusTeamBudget
Website RedesignPaidFrontend Team$12,500
Mobile AppUnpaidMobile Team$8,750
API IntegrationPendingBackend Team$5,200
Database MigrationPaidDevOps Team$3,800
User DashboardPaidUX Team$7,200
Security AuditFailedSecurity Team$2,100
Total Budget$39,550

On this page