Simple Table
A basic data table with no pagination, for small datasets.
The smallest install: only @niko-table/data-table, no add-ons. It renders an accessible <thead> and <tbody> and nothing more: no pagination, sort, or filters. Use it when the dataset is short and static.
Introduction
Section titled “Introduction”The Simple Table is the most basic setup. It shows your data in a clean, accessible table with no pagination, filtering, or sorting. Use it for small datasets (under 50 rows) or when you only need to display data.
Installation
Section titled “Installation”Install the DataTable core:
pnpm dlx shadcn@latest add @niko-table/data-tableFirst time using
@niko-table? See the Installation Guide to set up the registry.
For optional add-ons (pagination, filters, virtualization, etc.) and manual copy-paste, see the Installation Guide.
Prerequisites
Section titled “Prerequisites”We are going to build a table of users. Here’s what our data looks like:
type User = { id: string name: string email: string status: "active" | "inactive"}
const data: User[] = [ { id: "3", name: "Bob Johnson", status: "inactive", },]Basic Table
Section titled “Basic Table”Start with a basic table.
Column Definitions
Section titled “Column Definitions”First, define the columns.
"use client"
import type { DataTableColumnDef } from "@/components/niko-table/types"
export type User = { id: string name: string email: string status: "active" | "inactive"}
export const columns: DataTableColumnDef<User>[] = [ { accessorKey: "name", header: "Name", }, { accessorKey: "email", header: "Email", }, { accessorKey: "status", header: "Status", },]<DataTable /> component
Section titled “<DataTable /> component”Next, create a <DataTable /> component to render the table.
"use client"
import { DataTableRoot } from "@/components/niko-table/core/data-table-root"import { DataTable } from "@/components/niko-table/core/data-table"import { DataTableHeader, DataTableBody, DataTableSkeleton, DataTableEmptyBody,} from "@/components/niko-table/core/data-table-structure"import type { DataTableColumnDef } from "@/components/niko-table/types"
type User = { id: string name: string email: string status: "active" | "inactive"}
const columns: DataTableColumnDef<User>[] = [ { accessorKey: "name", header: "Name", }, { accessorKey: "email", header: "Email", }, { accessorKey: "status", header: "Status", },]
export function SimpleTable({ data }: { data: User[] }) { return ( <DataTableRoot data={data} columns={columns}> <DataTable> <DataTableHeader /> <DataTableBody> <DataTableSkeleton /> <DataTableEmptyBody /> </DataTableBody> </DataTable> </DataTableRoot> )}Cell Formatting
Section titled “Cell Formatting”Now format the status cell to show colors.
export const columns: DataTableColumnDef<User>[] = [ { accessorKey: "status", header: "Status", cell: ({ row }) => { const status = row.getValue("status") as string return ( <span className={status === "active" ? "text-green-600" : "text-gray-400"} > {status} </span> ) }, },]Use the same approach to format other cells.
Loading State
Section titled “Loading State”Show a loading skeleton while data is being fetched:
export function SimpleTable({ data, isLoading,}: { data: User[] isLoading?: boolean}) { return ( <DataTableRoot data={data} columns={columns} isLoading={isLoading}> <DataTable> <DataTableHeader /> <DataTableBody> <DataTableSkeleton /> <DataTableEmptyBody /> </DataTableBody> </DataTable> </DataTableRoot> )}DataTableSkeleton shows automatically when isLoading is true.
Empty State
Section titled “Empty State”DataTableEmptyBody shows automatically when there is no data, or when filters return no results.
When to Use
Section titled “When to Use”✅ Use Simple Table when:
- You have a small dataset (under 50 rows)
- You don’t need user interaction (sorting, filtering)
- You want the fastest, simplest setup
- You’re building a prototype or MVP
❌ Don’t use Simple Table when:
- You have more than 50 rows (use Basic Table with pagination)
- Users need to search or filter (use Search Table)
- Users need to sort columns (use Basic Table)
Next Steps
Section titled “Next Steps”Once you’re comfortable with the Simple Table, add more features:
- Basic Table: add pagination and sorting
- Search Table: add search