Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
15bd901
fix(sistent): add Table component documentation
kanishksingh23 May 2, 2026
f8d86bd
fix(sistent): fix Table docs formatting and add ThemeWrapper CodeBlock
kanishksingh23 May 2, 2026
6ae4068
fix(sistent): add missing imports to Table code.mdx
kanishksingh23 May 2, 2026
a839e49
fix(sistent): remove live JSX preview from code.mdx to fix build
kanishksingh23 May 2, 2026
f37c07a
fix(sistent): add live preview demos to Table code.mdx
kanishksingh23 May 2, 2026
d6a2ff2
fix(sistent): remove TableFooter and TablePagination from live demo
kanishksingh23 May 2, 2026
30ff088
fix(sistent): improve paginated table with MUI pagination and richer …
kanishksingh23 May 4, 2026
6127af9
Merge branch 'master' into fix/sistent-table-docs
Rajesh-Nagarajan-11 May 4, 2026
f9072a7
fix(sistent): rewrite all table demos using ResponsiveDataTable from …
kanishksingh23 May 5, 2026
da58a9a
fix(sistent): use client-side only import for ResponsiveDataTable to …
kanishksingh23 May 6, 2026
c30f63d
fix(sistent): guard ResponsiveDataTable demos against SSR with mounte…
kanishksingh23 May 6, 2026
b253725
fix(sistent): move mounted check after all hooks to fix React hooks o…
kanishksingh23 May 6, 2026
c8859df
fix(sistent): fix selectable rows state and replace names with generi…
kanishksingh23 May 7, 2026
60897e6
fix(sistent): move selectable table data outside component for stable…
kanishksingh23 May 7, 2026
f00b30a
fix(sistent): use useMemo for stable refs in SelectableTableDemo
kanishksingh23 May 7, 2026
7149e0e
fix(sistent): remove unsupported selection state from SelectableTable…
kanishksingh23 May 7, 2026
ef7a6aa
Merge branch 'master' into fix/sistent-table-docs
kanishksingh23 May 7, 2026
e1d7768
Merge branch 'master' into fix/sistent-table-docs
kanishksingh23 May 8, 2026
469d4a0
Merge branch 'master' into fix/sistent-table-docs
Rajesh-Nagarajan-11 May 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
380 changes: 380 additions & 0 deletions src/collections/sistent/components/table/code.mdx
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the code part ?

Image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You’ve added the code part but where’s the preview or example? Please check the other component’s code part and fix it.

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
@@ -0,0 +1,380 @@
---
title: Table Code
component: table
description: A table displays structured data in rows and columns, enabling users to scan, compare, and interact with information efficiently.
---

import { useState, useEffect, useMemo } from "react";
import { ResponsiveDataTable } from "@sistent/sistent";

export const BasicTableDemo = () => {
const [mounted, setMounted] = useState(false);
useEffect(() => setMounted(true), []);
const columns = [
{ name: "name", label: "Name" },
{ name: "env", label: "Environment" },
{ name: "status", label: "Status" },
];
const data = [
["meshery", "production", "Running"],
["nighthawk", "staging", "Stopped"],
["kanvas", "development", "Running"],
];
const [tableCols, updateCols] = useState(columns);
const [columnVisibility, setColumnVisibility] = useState({});
const options = {
filter: false, download: false, print: false, viewColumns: false,
selectableRows: "none", responsive: "standard", pagination: false,
search: false, elevation: 1,
};
if (!mounted) return null;
return (
<ResponsiveDataTable
columns={columns}
data={data}
options={options}
tableCols={tableCols}
updateCols={updateCols}
columnVisibility={columnVisibility}
colViews={columnVisibility}
/>
);
};

export const SortableTableDemo = () => {
const [mounted, setMounted] = useState(false);
useEffect(() => setMounted(true), []);
const columns = [
{ name: "name", label: "Name" },
{ name: "version", label: "Version" },
];
const data = [
["meshery", "v0.7.1"],
["kanvas", "v0.5.0"],
["nighthawk", "v0.9.3"],
];
const [tableCols, updateCols] = useState(columns);
const [columnVisibility, setColumnVisibility] = useState({});
const options = {
filter: false, download: false, print: false, viewColumns: false,
selectableRows: "none", responsive: "standard", pagination: false,
search: false, sort: true, elevation: 1,
};
if (!mounted) return null;
return (
<ResponsiveDataTable
columns={columns}
data={data}
options={options}
tableCols={tableCols}
updateCols={updateCols}
columnVisibility={columnVisibility}
colViews={columnVisibility}
/>
);
};


export const SelectableTableDemo = () => {
const [mounted, setMounted] = useState(false);
useEffect(() => setMounted(true), []);
const columns = useMemo(() => [
{ name: "name", label: "Name" },
{ name: "env", label: "Environment" },
], []);
const data = useMemo(() => [
["Alice", "production"],
["Bob", "staging"],
["Charlie", "development"],
], []);
const [tableCols, updateCols] = useState(columns);
const [columnVisibility, setColumnVisibility] = useState({});
const options = {
filter: false, download: false, print: false, viewColumns: false,
selectableRows: "multiple", responsive: "standard", pagination: false,
search: false, elevation: 1,
};
if (!mounted) return null;
return (
<ResponsiveDataTable
columns={columns}
data={data}
options={options}
tableCols={tableCols}
updateCols={updateCols}
columnVisibility={columnVisibility}
colViews={columnVisibility}
/>
);
};

export const PaginatedTableDemo = () => {
const [mounted, setMounted] = useState(false);
useEffect(() => setMounted(true), []);
const columns = [
{ name: "name", label: "Name" },
{ name: "owner", label: "Owner" },
{ name: "age", label: "Age" },
{ name: "status", label: "Status" },
];
const data = Array.from({ length: 20 }, (_, i) => [
"service-" + (i + 1),
i % 3 === 0 ? "Alice" : i % 3 === 1 ? "Bob" : "Charlie",
(i + 1) + " months ago",
i % 2 === 0 ? "Running" : "Stopped",
]);
const [tableCols, updateCols] = useState(columns);
const [columnVisibility, setColumnVisibility] = useState({});
const options = {
filter: false, download: false, print: false, viewColumns: false,
selectableRows: "none", responsive: "standard", pagination: true,
rowsPerPage: 5, rowsPerPageOptions: [5, 10, 20], elevation: 1,
};
if (!mounted) return null;
return (
<ResponsiveDataTable
columns={columns}
data={data}
options={options}
tableCols={tableCols}
updateCols={updateCols}
columnVisibility={columnVisibility}
colViews={columnVisibility}
/>
);
};

Tables communicate actions and data to users and can be placed at several places throughout the user interface.

<a id="Basic Table">
<h2>Basic Table</h2>
</a>

A minimal read-only table with a header row and data rows.

<div className="showcase">
<div className="items">
<ThemeWrapper>
<BasicTableDemo />
</ThemeWrapper>
</div>
<CodeBlock name="basic-table" collapsible code={`import { useState, useEffect, useMemo } from "react";
import { ResponsiveDataTable } from "@sistent/sistent";

const columns = [
{ name: "name", label: "Name" },
{ name: "env", label: "Environment" },
{ name: "status", label: "Status" },
];

const data = [
["meshery", "production", "Running"],
["nighthawk", "staging", "Stopped"],
["kanvas", "development", "Running"],
];

export default function BasicTable() {
const [tableCols, updateCols] = useState(columns);
const [columnVisibility, setColumnVisibility] = useState({});

const options = {
filter: false,
download: false,
print: false,
viewColumns: false,
selectableRows: "none",
responsive: "standard",
pagination: false,
search: false,
elevation: 1,
};

if (!mounted) return null;
return (
<ResponsiveDataTable
columns={columns}
data={data}
options={options}
tableCols={tableCols}
updateCols={updateCols}
columnVisibility={columnVisibility}
colViews={columnVisibility}
/>
);
}`} />
</div>

<a id="Sortable Table">
<h2>Sortable Table</h2>
</a>

Clicking a column header sorts rows ascending or descending by that column.

<div className="showcase">
<div className="items">
<ThemeWrapper>
<SortableTableDemo />
</ThemeWrapper>
</div>
<CodeBlock name="sortable-table" collapsible code={`import { useState, useEffect, useMemo } from "react";
import { ResponsiveDataTable } from "@sistent/sistent";

const columns = [
{ name: "name", label: "Name" },
{ name: "version", label: "Version" },
];

const data = [
["meshery", "v0.7.1"],
["kanvas", "v0.5.0"],
["nighthawk", "v0.9.3"],
];

export default function SortableTable() {
const [tableCols, updateCols] = useState(columns);
const [columnVisibility, setColumnVisibility] = useState({});

const options = {
filter: false,
download: false,
print: false,
viewColumns: false,
selectableRows: "none",
responsive: "standard",
pagination: false,
search: false,
sort: true,
elevation: 1,
};

if (!mounted) return null;
return (
<ResponsiveDataTable
columns={columns}
data={data}
options={options}
tableCols={tableCols}
updateCols={updateCols}
columnVisibility={columnVisibility}
colViews={columnVisibility}
/>
);
}`} />
</div>

<a id="Selectable Rows Table">
<h2>Selectable Rows Table</h2>
</a>

Setting <code>selectableRows</code> to <code>"multiple"</code> enables checkbox selection on each row.

<div className="showcase">
<div className="items">
<ThemeWrapper>
<SelectableTableDemo />
</ThemeWrapper>
</div>
<CodeBlock name="selectable-table" collapsible code={`import { useState, useEffect, useMemo } from "react";
import { ResponsiveDataTable } from "@sistent/sistent";

const columns = [
{ name: "name", label: "Name" },
{ name: "env", label: "Environment" },
];

const data = [
["Alice", "production"],
["Bob", "staging"],
["Charlie", "development"],
];

export default function SelectableTable() {
const [tableCols, updateCols] = useState(columns);
const [columnVisibility, setColumnVisibility] = useState({});
const options = {
filter: false,
download: false,
print: false,
viewColumns: false,
selectableRows: "multiple",
responsive: "standard",
pagination: false,
search: false,
elevation: 1,
};

if (!mounted) return null;
return (
<ResponsiveDataTable
columns={columns}
data={data}
options={options}
tableCols={tableCols}
updateCols={updateCols}
columnVisibility={columnVisibility}
colViews={columnVisibility}
/>
);
}`} />
</div>

<a id="Paginated Table">
<h2>Paginated Table</h2>
</a>

<code>ResponsiveDataTable</code> from <code>@sistent/sistent</code> provides built-in pagination, column visibility, and responsive layout controls.

<div className="showcase">
<div className="items">
<ThemeWrapper>
<PaginatedTableDemo />
</ThemeWrapper>
</div>
<CodeBlock name="paginated-table" collapsible code={`import { useState, useEffect, useMemo } from "react";
import { ResponsiveDataTable } from "@sistent/sistent";

const columns = [
{ name: "name", label: "Name" },
{ name: "owner", label: "Owner" },
{ name: "age", label: "Age" },
{ name: "status", label: "Status" },
];

const data = Array.from({ length: 20 }, (_, i) => [
"service-" + (i + 1),
i % 3 === 0 ? "Alice" : i % 3 === 1 ? "Bob" : "Charlie",
(i + 1) + " months ago",
i % 2 === 0 ? "Running" : "Stopped",
]);

export default function PaginatedTable() {
const [tableCols, updateCols] = useState(columns);
const [columnVisibility, setColumnVisibility] = useState({});

const options = {
filter: false,
download: false,
print: false,
viewColumns: false,
selectableRows: "none",
responsive: "standard",
pagination: true,
rowsPerPage: 5,
rowsPerPageOptions: [5, 10, 20],
elevation: 1,
};

if (!mounted) return null;
return (
<ResponsiveDataTable
columns={columns}
data={data}
options={options}
tableCols={tableCols}
updateCols={updateCols}
columnVisibility={columnVisibility}
colViews={columnVisibility}
/>
);
}`} />
</div>
Loading
Loading