Table
To create a basic table, compose <Table>, <TableHeader>, <TableBody>, <TableRow>, <TableHead>, and <TableCell>.
import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell,} from "stylus-ui/Table";
const data = [ { name: "Thomas Kao", role: "Creator", lastActive: "Jul 01, 2024", views: "70.3k", }, { name: "Aleksandar Radic", role: "Team Admin", lastActive: "Jul 01, 2024", views: "52.4k", }, { name: "Maria Mi", role: "Team Admin", lastActive: "Jul 01, 2024", views: "20.3k", },];
export default () => ( <Table> <TableHeader> <TableRow> <TableHead>Name</TableHead> <TableHead>Role</TableHead> <TableHead>Last Active</TableHead> <TableHead>Views</TableHead> </TableRow> </TableHeader> <TableBody> {data.map((row) => ( <TableRow> <TableCell>{row.name}</TableCell> <TableCell>{row.role}</TableCell> <TableCell> <time dateTime={row.lastActive}>{row.lastActive}</time> </TableCell> <TableCell>{row.views}</TableCell> </TableRow> ))} </TableBody> </Table>);Loading
Section titled “Loading”Show a loading state by passing loading to <TableBody> along with numColumns and numRows.
import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell,} from "stylus-ui/Table";
export default () => ( <Table> <TableHeader> <TableRow> <TableHead>Name</TableHead> <TableHead>Role</TableHead> <TableHead>Last Active</TableHead> <TableHead>Views</TableHead> </TableRow> </TableHeader> <TableBody loading numColumns={4} numRows={8} /> </Table>);API Reference
Section titled “API Reference”Display simple, static tabular data. For more complex data tables, use DataTable.
containerClassName
Classes applied to the scroll wrapper around the table.
scrollAreaProps
Props passed to the ScrollArea wrapper (e.g. viewportRef).
theme
Visual theme for the scroll area.
TableHeader
Section titled “TableHeader”Wrapper for the table head section (<thead>). Accepts all native thead attributes.
TableCell
Section titled “TableCell”Table body cell (<td>) with default padding and typography. Accepts all native td attributes.
TableSkeleton
Section titled “TableSkeleton” checkboxRow
Zero-based column index to render as a checkbox skeleton (-1 for none).
className
Classes applied to each skeleton cell.
numColumns
Number of columns to show as skeleton cells.
numRows
Number of skeleton rows.
TableBody
Section titled “TableBody” checkboxRow
Zero-based column index for checkbox skeleton (when loading).
loading
When true, show skeleton rows instead of children.
numColumns
Number of columns for skeleton (when loading).
numRows
Number of skeleton rows (when loading).
skeletonClassName
Classes applied to skeleton cells (when loading).
TableFooter
Section titled “TableFooter”Wrapper for the table footer section (<tfoot>). Accepts all native tfoot attributes.
TableRow
Section titled “TableRow” disabled
Visually dim the row and prevent interaction.
TableHead
Section titled “TableHead”Table header cell (<th>) with default styling. Accepts all native th attributes.
TableCaption
Section titled “TableCaption”Table caption with muted styling. Accepts all native caption attributes.