Table
Display tabular data using rows and columns.
Want to skip the docs? Try our MCP Server
These are very low level primitives used for implementing the basic table styles. Use DataTable if you are looking for a fully featured table component.
#
Documentation
#
#
Usage
#
First Name | Last Name | Company | Address |
|---|---|---|---|
| Fred | Jackson | Acme, Inc. | 123 Broad St. |
| Sara | James | Acme, Inc. | 123 Broad St. |
| Ralph | Jefferson | XYZ, Inc. | 456 Main St. |
| Nancy | Jensen | XYZ, Inc. | 456 Main St. |
App.tsx
import {
Table,
TableBody,
TableCell,
TableHeader,
TableHeaderCell,
TableRow,
} from "@optiaxiom/react";
import { data } from "./data";
export function App() {
return (
<Table>
<TableHeader>
<TableRow>
<TableHeaderCell>First Name</TableHeaderCell>
<TableHeaderCell>Last Name</TableHeaderCell>
<TableHeaderCell>Company</TableHeaderCell>
<TableHeaderCell>Address</TableHeaderCell>
</TableRow>
</TableHeader>
<TableBody>
{data.map((row) => (
<TableRow key={row.id}>
<TableCell>{row.firstName}</TableCell>
<TableCell>{row.lastName}</TableCell>
<TableCell>{row.company}</TableCell>
<TableCell>{row.address}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
);
}#
Anatomy
#
import {
Table,
TableBody,
TableCell,
TableHeader,
TableHeaderCell,
TableRow,
} from "@optiaxiom/react/unstable";
export default () => (
<Table>
<TableHeader>
<TableRow>
<TableHeaderCell />
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell>
<TableAction />
</TableCell>
</TableRow>
</TableBody>
</Table>
);#
Related
#
Pagination
Display active page and navigate between multiple pages.
#
Props
#
#
Table
#
Supports all Box props in addition to its own. Renders a <table> element.
Prop |
|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read the Composition guide for more details.
|
className
|
layoutUse default table layout or grid for rows and cells.
Default: |
#
TableHeader
#
Supports all Box props in addition to its own. Renders a <thead> element.
Prop |
|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read the Composition guide for more details.
|
className
|
pinnedWhether to pin the header cell to left/right of table.
|
#
TableHeaderCell
#
Supports all Box props in addition to its own. Renders a <th> element.
Prop |
|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read the Composition guide for more details.
|
className
|
pinnedWhether to pin the header cell to left/right of table.
Default: |
pxSet the element’s left and right padding ⚠️ WARNING: Do NOT use arbitrary values like “10px” or “5rem”. Only predefined spacing tokens are accepted.
Default: |
pySet the element’s top and bottom padding ⚠️ WARNING: Do NOT use arbitrary values like “10px” or “5rem”. Only predefined spacing tokens are accepted.
Default: |
#
TableBody
#
Supports all Box props in addition to its own. Renders a <tbody> element.
Prop |
|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read the Composition guide for more details.
|
className
|
#
TableRow
#
Supports all Box props in addition to its own. Renders a <tr> element.
Prop |
|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read the Composition guide for more details.
|
className
|
#
TableCell
#
Supports all Box props in addition to its own. Renders a <td> element.
Prop |
|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read the Composition guide for more details.
|
className
|
pinnedWhether to pin the header cell to left/right of table.
Default: |
#
TableAction
#
Supports all Box props in addition to its own. Renders a <div> element.
Prop |
|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read the Composition guide for more details.
Default: |
className
|
visibleControl whether to always show the contents or only when user is hovering or interacting with them.
|
#
Changelog
#
#
1.4.0
#
-
Moved component out of Alpha.
// Before import { Table } from "@optiaxiom/react/unstable"; // After import { Table } from "@optiaxiom/react";
#
0.1.0
#
- Added component