Quick Start

Add Simple Table to your app in about 60 seconds.

Paste into your AI coding tool to install Simple Table, map this app's data into columns and rows, and match your design system.

  1. Install

    Full install options (yarn, pnpm) are on the Installation page.
    Shell
    npm install @simple-table/react
  2. Import

    Import the table component and its CSS styles.
    TypeScript
    import { SimpleTable, type ReactColumnDef } from "@simple-table/react";
    import "@simple-table/react/styles.css";
  3. Define columns

    Each column needs an accessor that matches a property on your row objects.
    TypeScript
    const columns: ReactColumnDef[] = [
    { accessor: "id", label: "ID", width: 80, type: "number" },
    { accessor: "name", label: "Name", width: "1fr", type: "string" },
    { accessor: "age", label: "Age", width: 80, type: "number" },
    ];
  4. Define rows

    Provide an array of objects, one object per row.
    TypeScript
    const rows = [
    { id: 1, name: "John Doe", age: 30 },
    { id: 2, name: "Jane Smith", age: 25 },
    ];
  5. Render the table

    Pass columns and rows to the table. Set height so the table scrolls with a sticky header.
    React TSX
    <SimpleTable columns={columns} rows={rows} height="400px" />

Example

A live table built with the same props. Use Code or StackBlitz to explore the full example.

Height

Prefer height or maxHeight so the table owns scrolling. Details in Table Height.

getRowId (recommended)

Provide a stable id when you sort, filter, group, or update rows often: getRowId={({ row }) => String(row.id)}

SimpleTable Props

Main Component Props

PropertyRequiredDescriptionExample
Required
Array of column definitions that specify the structure of your table.
rows
Required
Array of data objects to display in the table. Each object represents a row.
Optional
Optional but recommended: Function to generate unique identifiers for each row. Receives detailed context (row, depth, index, paths). Enables stable row identification across sorting and filtering. Highly recommended for tables with row grouping, external sorting, or dynamic data updates.
height
Optional
Height of the table container. When specified, Simple Table handles vertical scrolling internally with a fixed header. When omitted, the table expands to fit all rows and overflows the parent container. Most applications should specify a height.
customTheme
Optional
Custom theme configuration for dimensions and spacing. Only specify the properties you want to customize.
enableColumnEditor
boolean
Optional
Enable column reordering by drag and drop.
selectableCells
boolean
Optional
Enable cell selection functionality.
theme
Optional
Custom theme object to override default styling.