Table
A table component for displaying tabular data with head, body, footer, and configurable variants and sizes.
Basic Usage
| Name | Role | |
|---|---|---|
| Jane Doe | jane@example.com | Admin |
| John Smith | john@example.com | User |
import {
Table,
TableHead,
TableBody,
TableRow,
TableHeader,
TableCell,
} from 'uiplex';
<Table>
<TableHead>
<TableRow>
<TableHeader>Name</TableHeader>
<TableHeader>Email</TableHeader>
<TableHeader>Role</TableHeader>
</TableRow>
</TableHead>
<TableBody>
<TableRow>
<TableCell>Jane Doe</TableCell>
<TableCell>jane@example.com</TableCell>
<TableCell>Admin</TableCell>
</TableRow>
<TableRow>
<TableCell>John Smith</TableCell>
<TableCell>john@example.com</TableCell>
<TableCell>User</TableCell>
</TableRow>
</TableBody>
</Table>Variants
Default
| Product | Price |
|---|---|
| Widget A | $10 |
| Widget B | $20 |
Bordered
| Product | Price |
|---|---|
| Widget A | $10 |
| Widget B | $20 |
Striped
| Product | Price |
|---|---|
| Widget A | $10 |
| Widget B | $20 |
| Widget C | $30 |
<Table variant="default">...</Table>
<Table variant="bordered">...</Table>
<Table variant="striped">...</Table>Sizes
Small
| Col 1 | Col 2 |
|---|---|
| Row 1 | Data |
Medium (default)
| Col 1 | Col 2 |
|---|---|
| Row 1 | Data |
Large
| Col 1 | Col 2 |
|---|---|
| Row 1 | Data |
<Table size="sm">...</Table>
<Table size="md">...</Table>
<Table size="lg">...</Table>With Footer
| Item | Qty | Amount |
|---|---|---|
| Widget A | 2 | $20 |
| Widget B | 1 | $20 |
| Total | $40 | |
<Table variant="bordered">
<TableHead>...</TableHead>
<TableBody>...</TableBody>
<TableFooter>
<TableRow>
<TableCell colSpan={2}>Total</TableCell>
<TableCell>$60</TableCell>
</TableRow>
</TableFooter>
</Table>API Reference
Table
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "bordered" | "striped" | "default" | Visual style of the table |
| size | "sm" | "md" | "lg" | "md" | Cell padding and font size |
| className | string | "" | Additional CSS classes |
| style | React.CSSProperties | - | Inline styles |
TableHead, TableBody, TableFooter, TableRow
| Prop | Type | Default | Description |
|---|---|---|---|
| children | React.ReactNode | - | Table section content |
| className | string | "" | Additional CSS classes |
TableHeader, TableCell
| Prop | Type | Default | Description |
|---|---|---|---|
| children | React.ReactNode | - | Cell content |
| colSpan | number | - | Number of columns to span (HTML attribute) |
| rowSpan | number | - | Number of rows to span (HTML attribute) |
| className | string | "" | Additional CSS classes |