✨ Working with PDFs, images or videos? Discover 145+ free web apps built for everyday tasks

Data Table

A complete data table primitive that composes Table building blocks with built-in search, column sorting, row selection, pagination, and expandable detail rows. All features compose — enable only what you need.

Loading preview...

Examples

Practical examples and common states for the same installable component.

Sortable

Click column headers to sort rows ascending or descending.

examples/data-table-sortable.tsx
"use client";
import {
DataTable,
type DataTableColumn,
} from "@/components/wensity/data-table";
type Invoice = {
id: string;
customer: string;
plan: string;
amount: string;
status: string;
};
const columns: DataTableColumn<Invoice>[] = [
{ id: "customer", header: "Customer", accessorKey: "customer", sortable: true },
{ id: "plan", header: "Plan", accessorKey: "plan", sortable: true },
{ id: "amount", header: "Amount", accessorKey: "amount", sortable: true },
{ id: "status", header: "Status", accessorKey: "status", sortable: true },
];
export function SortableDataTable({ data }: { data: Invoice[] }) {
return <DataTable columns={columns} data={data} sortable />;
}

Filterable

Built-in search bar filters across all columns with debounced input.

examples/data-table-filterable.tsx
"use client";
import {
DataTable,
type DataTableColumn,
} from "@/components/wensity/data-table";
type Invoice = {
id: string;
customer: string;
plan: string;
status: string;
};
const columns: DataTableColumn<Invoice>[] = [
{ id: "customer", header: "Customer", accessorKey: "customer" },
{ id: "plan", header: "Plan", accessorKey: "plan" },
{ id: "status", header: "Status", accessorKey: "status" },
];
export function FilterableDataTable({ data }: { data: Invoice[] }) {
return (
<DataTable
columns={columns}
data={data}
filterable={{ placeholder: "Search invoices…" }}
/>
);
}

Selectable

Checkbox column with select-all and individual row selection.

examples/data-table-selectable.tsx
"use client";
import {
DataTable,
type DataTableColumn,
} from "@/components/wensity/data-table";
type User = {
id: string;
name: string;
role: string;
};
const columns: DataTableColumn<User>[] = [
{ id: "name", header: "Name", accessorKey: "name" },
{ id: "role", header: "Role", accessorKey: "role" },
];
export function SelectableDataTable({ data }: { data: User[] }) {
return <DataTable columns={columns} data={data} selectable />;
}

Paginated

Splits large datasets across pages with compact pagination controls.

examples/data-table-paginated.tsx
"use client";
import {
DataTable,
type DataTableColumn,
} from "@/components/wensity/data-table";
type Invoice = {
id: string;
customer: string;
plan: string;
amount: string;
status: string;
};
const columns: DataTableColumn<Invoice>[] = [
{ id: "customer", header: "Customer", accessorKey: "customer", sortable: true },
{ id: "plan", header: "Plan", accessorKey: "plan" },
{ id: "amount", header: "Amount", accessorKey: "amount", sortable: true },
{ id: "status", header: "Status", accessorKey: "status" },
];
export function PaginatedDataTable({ data }: { data: Invoice[] }) {
return (
<DataTable
columns={columns}
data={data}
sortable
paginated={{ pageSize: 5 }}
/>
);
}

Expandable

Click any row to reveal additional details in an expandable panel.

examples/data-table-expandable.tsx
"use client";
import {
DataTable,
type DataTableColumn,
} from "@/components/wensity/data-table";
type Invoice = {
id: string;
customer: string;
plan: string;
status: string;
detail: string;
};
const columns: DataTableColumn<Invoice>[] = [
{ id: "customer", header: "Customer", accessorKey: "customer" },
{ id: "plan", header: "Plan", accessorKey: "plan" },
{ id: "status", header: "Status", accessorKey: "status" },
];
export function ExpandableDataTable({ data }: { data: Invoice[] }) {
return (
<DataTable
columns={columns}
data={data}
expandable={{
renderExpanded: (row) => (
<div className="text-xs text-muted-foreground">
<p><strong>ID:</strong> {row.id}</p>
<p>{row.detail}</p>
</div>
),
}}
/>
);
}