Skip to content

Table

Semantic table primitives: header, body, row, cell and caption.

Installation

bun add @xerobi/ui
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "@xerobi/ui/table"

This component is client-side. In Astro, hydrate it with a client directive.

Examples

Default

NameStatus
Worker 1Active
Worker 2Paused
Worker 3Active
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@xerobi/ui/table"

export function TableDefault() {
  return (
    <Table className="w-80">
      <TableHeader>
        <TableRow>
          <TableHead>Name</TableHead>
          <TableHead>Status</TableHead>
        </TableRow>
      </TableHeader>
      <TableBody>
        <TableRow>
          <TableCell>Worker 1</TableCell>
          <TableCell>Active</TableCell>
        </TableRow>
        <TableRow>
          <TableCell>Worker 2</TableCell>
          <TableCell>Paused</TableCell>
        </TableRow>
        <TableRow>
          <TableCell>Worker 3</TableCell>
          <TableCell>Active</TableCell>
        </TableRow>
      </TableBody>
    </Table>
  )
}

API reference

Table

Also accepts every prop of <table> element.

No props of its own.

TableBody

Also accepts every prop of <tbody> element.

No props of its own.

TableCaption

Also accepts every prop of <caption> element.

No props of its own.

TableCell

Also accepts every prop of <td> element.

No props of its own.

TableFooter

Also accepts every prop of <tfoot> element.

No props of its own.

TableHead

Also accepts every prop of <th> element.

No props of its own.

TableHeader

Also accepts every prop of <thead> element.

No props of its own.

TableRow

Also accepts every prop of <tr> element.

No props of its own.

Styling hooks: [data-slot="table-container"], [data-slot="table"], [data-slot="table-header"], [data-slot="table-body"], [data-slot="table-footer"], [data-slot="table-row"], [data-slot="table-head"], [data-slot="table-cell"], [data-slot="table-caption"].

Search documentation

Search pages, components and blocks.