mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
69 lines
1.2 KiB
TypeScript
69 lines
1.2 KiB
TypeScript
const App = `import {Table, TableHeader, TableColumn, TableBody, TableRow, TableCell, getKeyValue} from "@nextui-org/react";
|
|
|
|
const rows = [
|
|
{
|
|
key: "1",
|
|
name: "Tony Reichert",
|
|
role: "CEO",
|
|
status: "Active",
|
|
},
|
|
{
|
|
key: "2",
|
|
name: "Zoey Lang",
|
|
role: "Technical Lead",
|
|
status: "Paused",
|
|
},
|
|
{
|
|
key: "3",
|
|
name: "Jane Fisher",
|
|
role: "Senior Developer",
|
|
status: "Active",
|
|
},
|
|
{
|
|
key: "4",
|
|
name: "William Howard",
|
|
role: "Community Manager",
|
|
status: "Vacation",
|
|
},
|
|
];
|
|
|
|
const columns = [
|
|
{
|
|
key: "name",
|
|
label: "NAME",
|
|
},
|
|
{
|
|
key: "role",
|
|
label: "ROLE",
|
|
},
|
|
{
|
|
key: "status",
|
|
label: "STATUS",
|
|
},
|
|
];
|
|
|
|
export default function App() {
|
|
return (
|
|
<Table aria-label="Example table with dynamic content">
|
|
<TableHeader columns={columns}>
|
|
{(column) => <TableColumn key={column.key}>{column.label}</TableColumn>}
|
|
</TableHeader>
|
|
<TableBody items={rows}>
|
|
{(item) => (
|
|
<TableRow key={item.key}>
|
|
{(columnKey) => <TableCell>{getKeyValue(item, columnKey)}</TableCell>}
|
|
</TableRow>
|
|
)}
|
|
</TableBody>
|
|
</Table>
|
|
);
|
|
}`;
|
|
|
|
const react = {
|
|
"/App.jsx": App,
|
|
};
|
|
|
|
export default {
|
|
...react,
|
|
};
|