Table
Display tabular data using rows and columns.
#
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. |
import {
Table,
TableBody,
TableCell,
TableHeader,
TableHeaderCell,
TableRow,
} from "@optiaxiom/react/unstable";
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 />
</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 |
---|
asChild Change the default rendered element for the one passed as a child, merging their props and behavior. Read the Composition guide for more details. false | true |
className string |
layout "auto" | "fixed" Default: auto |
#
TableHeader
#
Supports all Box props in addition to its own. Renders a <thead>
element.
Prop |
---|
asChild Change the default rendered element for the one passed as a child, merging their props and behavior. Read the Composition guide for more details. false | true |
className string |
#
TableHeaderCell
#
Supports all Box props in addition to its own. Renders a <th>
element.
Prop |
---|
asChild Change the default rendered element for the one passed as a child, merging their props and behavior. Read the Composition guide for more details. false | true |
className string |
#
TableBody
#
Supports all Box props in addition to its own. Renders a <tbody>
element.
Prop |
---|
asChild Change the default rendered element for the one passed as a child, merging their props and behavior. Read the Composition guide for more details. false | true |
className string |
#
TableRow
#
Supports all Box props in addition to its own. Renders a <tr>
element.
Prop |
---|
asChild Change the default rendered element for the one passed as a child, merging their props and behavior. Read the Composition guide for more details. false | true |
className string |
#
TableCell
#
Supports all Box props in addition to its own. Renders a <td>
element.
Prop |
---|
asChild Change the default rendered element for the one passed as a child, merging their props and behavior. Read the Composition guide for more details. false | true |
className string |
#
Changelog
#
#
0.1.0
#
- Added component