# Install + first grid

Install @pretable/react and render your first three-column grid in five minutes.


This is `@pretable/react` and `@pretable/ui` rendering a three-column, five-row grid — a drop-in `<Pretable>` component, an array of rows, and two stylesheet imports:

### Example: Render your first grid

Three columns and five rows rendered with the Pretable drop-in component, no controlled state required.

Source: https://pretable.ai/examples/first-grid.md

```tsx demo.tsx
"use client";

import { Pretable } from "@pretable/react";

import { columns } from "./columns";
import { people } from "./data";

export default function Demo() {
  return (
    <Pretable
      ariaLabel="Team roster"
      rows={people}
      columns={columns}
      getRowId={(r) => r.id}
    />
  );
}
```

```ts columns.ts
import type { PretableColumn } from "@pretable/react";

import type { Person } from "./data";

export const columns: PretableColumn<Person>[] = [
  { id: "name", header: "Name", value: (r) => r.name },
  { id: "role", header: "Role", value: (r) => r.role },
  { id: "city", header: "City", value: (r) => r.city },
];
```

```ts data.ts
export interface Person {
  id: string;
  name: string;
  role: string;
  city: string;
}

export const people: Person[] = [
  { id: "1", name: "Ada", role: "Engineer", city: "London" },
  { id: "2", name: "Grace", role: "Admiral", city: "New York" },
  { id: "3", name: "Linus", role: "Maintainer", city: "Helsinki" },
  { id: "4", name: "Margaret", role: "Director", city: "Boston" },
  { id: "5", name: "Tim", role: "Inventor", city: "London" },
];
```


That's the full surface for a static grid. Two packages, one component, no configuration beyond `columns` and `rows`. Here's how you got there.

## Install the packages

`npm i @pretable/react @pretable/ui` — the `react` package is the engine, `ui` ships the themes.

Requires matching React and ReactDOM 18 or 19 releases supplied by your
application. React 18.0.0 is the supported floor; React 17 and earlier are
unsupported.

## Import the styles

Import the default theme and the grid skin once at your app's entry point, the same two imports the grid above is running:

```css
@import "@pretable/ui/themes/pretable.css";
@import "@pretable/ui/grid.css";
```

The theme file declares all `--pretable-*` tokens at `:root`; `grid.css` is the selector-based skin that targets the engine's `[data-pretable-*]` data attributes. Three themes ship today — `pretable.css` (the house theme and the default, light + dark), `excel.css` (gray, dense, technical, light-only), and `material.css` (Material 3, light + dark). The last two are compatibility skins for apps that already look like one of those; see [Pick a theme](/docs/theming/pick-a-theme). Toggle dark mode by setting `data-theme="dark"` on `<html>`. If you only need the engine, skip both imports and the grid renders unstyled — functional but no visual chrome, the state the grid above would be in without them.

<Callout type="tip">
  Tailwind v4 users can additionally import `@pretable/ui/tailwind.css` to get `bg-pt-*`/`text-pt-*` utility shortcuts that alias the `--pretable-*` tokens. Density (compact / standard / spacious) is runtime-switchable by toggling `data-density="..."` on `<html>`.
</Callout>

Pretable publishes ESM and CommonJS entry points with ES2018 syntax. See the
[package compatibility guide](https://github.com/cacheplane/pretable/blob/main/docs/compatibility.md)
for older-bundler boundaries, required runtime APIs, and supported public import
paths.

Sort, filter, selection, and streaming rows are layered on top of what you just saw — see [/docs/streaming](/docs/streaming) for the streaming-adapter API while a guide for the rest is being written.

## What's next

API reference and recipes are in flight. For now, browse the [public exports](https://github.com/cacheplane/pretable/blob/main/packages/react/src/index.ts) and [/docs/streaming](/docs/streaming) for the streaming-adapter API.
