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”Wraps the table and its content.
Inherits properties from HTMLTableElement.
TableHeader
Section titled “TableHeader”Wraps one or more <TableRow>s containing <TableHead> cells.
Inherits properties from HTMLTableSectionElement.
TableBody
Section titled “TableBody”Wraps one or more <TableRow>s containing <TableCell>s.
Inherits properties from HTMLTableSectionElement.
TableRow
Section titled “TableRow”Wraps a table row and its content.
Inherits properties from HTMLTableRowElement.
TableHead
Section titled “TableHead”A table header cell.
Inherits properties from HTMLTableCellElement.
TableCell
Section titled “TableCell”A table cell.
Inherits properties from HTMLTableCellElement.
TableCaption
Section titled “TableCaption”A table caption.
Inherits properties from HTMLTableCaptionElement.