Table

A semantic HTML table with consistent Aether UI styling. Composed of eight sub-components that map directly to HTML table elements: Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, and TableCaption.

  • Wraps in an overflow-auto container for horizontal scrolling on small screens
  • Hover and selected row states
  • TableFooter for summary rows
  • TableCaption for screen reader context
  • All sub-components forward refs
NameRoleStatus
Alice ChenAdmin
Active
Bob MarshEditor
Active
Carla VossViewer
Inactive

import { Table }from "@aetherstack/ui"

table.tsx
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import { Badge } from "@/components/ui/badge"

const users = [
  { name: "Alice Chen", role: "Admin", status: "Active" },
  { name: "Bob Marsh", role: "Editor", status: "Active" },
  { name: "Carla Voss", role: "Viewer", status: "Inactive" },
]

export function TableDemo() {
  return (
    <Table>
      <TableHeader>
        <TableRow>
          <TableHead>Name</TableHead>
          <TableHead>Role</TableHead>
          <TableHead>Status</TableHead>
        </TableRow>
      </TableHeader>
      <TableBody>
        {users.map((user) => (
          <TableRow key={user.name}>
            <TableCell className="font-medium">{user.name}</TableCell>
            <TableCell>{user.role}</TableCell>
            <TableCell>
              <Badge variant={user.status === "Active" ? "default" : "secondary"}>
                {user.status}
              </Badge>
            </TableCell>
          </TableRow>
        ))}
      </TableBody>
    </Table>
  )
}

Usage

Full table with footer

Use TableFooter for summary rows like totals.

Team member list
NameEmailRoleJoined
Alice Chenalice@acme.comAdminJan 2025
Bob Marshbob@acme.comEditorJan 2025
Carla Vosscarla@acme.comViewerJan 2025
Dave Yudave@acme.comEditorJan 2025
Total4 members

With row actions

Add an actions column with inline buttons.

NameRoleActions
Alice ChenAdmin
Bob MarshEditor
Carla VossViewer

Props

PropTypeDefaultDescription

Table

PropTypeDefaultDescription
classNamestringApplied to the inner <table> element. The outer wrapper is always w-full overflow-auto.
...propsReact.HTMLAttributes<HTMLTableElement>All standard HTML table attributes.

TableRow

PropTypeDefaultDescription
data-[state=selected]Add data-state='selected' to highlight a selected row.
classNamestringAdditional classes.

TableHead

PropTypeDefaultDescription
classNamestringApplied to <th>. Defaults to h-12 px-4 text-left align-middle font-medium text-muted-foreground.

TableCell

PropTypeDefaultDescription
colSpannumberSpans multiple columns (for footer totals, etc.).
classNamestringApplied to <td>. Defaults to p-4 align-middle.

TableCaption

PropTypeDefaultDescription
classNamestringApplied to <caption>. Defaults to mt-4 text-sm text-muted-foreground.

* Required props

Accessibility

  • Use TableCaption to provide a text description of the table — screen readers announce it before reading the table content.
  • Use TableHead (<th>) for column headers — this creates the correct ARIA column header semantics.
  • For row headers (first column), add scope='row' to TableCell elements.
  • Use aria-sort on TableHead elements for sortable columns.