Your next page is taking shape...

Opening Your Next Page…

Loading the guide and preparing its examples for you to explore. The page will appear here automatically when it’s ready, so you can keep this view open without refreshing.

Made for Preact. Built to be yours.

Data & Comparison

Data Table

Data tables pair `Table` primitives with app state (sorting, filters, pagination). `DataTable` adds the bordered shell from shadcn; full grids are composed in your app or demo. Help people compare information without losing labels, units or context. Build the empty and loading states alongside the populated example. Import it from @/components/kamod-ui/data-table.

Source · Design reference · API reference · Theming · Styles


Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Installation

Use Table, TableHeader, TableBody, TableRow, TableHead, and TableCell from @/components/kamod-ui/data-table. Optional: DataTable wraps the table in overflow-hidden rounded-md border. The official shadcn guide uses @tanstack/react-table (React); this Preact demo implements the same UX with local state — you can adopt TanStack in a React app following https://ui.shadcn.com/docs/components/radix/data-table

Install PackagesTerminal
pnpm add @kamod-ch/ui

Copy an example with @kamod-ch/ui or the matching @kamod-ch/ui/… subpath. The code block switches between those two installs. Connect The Global Theme CSS and Tailwind Source Detection before your first render.

Usage

PaymentsDataTableDemo (below) matches the documented flow: column toolbar (email filter + column visibility), sortable email header, currency amount, row actions Dropdown, checkboxes with header indeterminate state, selected count, and prev/next pagination. Set chrome={false} on DataTable if you provide your own border.

Import SetupTypeScript
import { DataTable } from "@kamod-ch/ui";

Choose a complete composition from the examples below; required child components and props vary by pattern.

Component Examples & Variants

Explore Data Table in Different Contexts, from the starting pattern to the compositions below. Begin with Payments Demo, then compare the examples that match your content, state and layout. These are working patterns to adapt, not a list of interchangeable variant values: check the API Reference before using a prop or combining behaviors. Look at the surrounding labels, supporting text and spacing as well as the component itself.

Read the Result and Its Implementation Together. Use each showcase’s Code view to inspect imports and composition, or its Prompt view to prepare a setup or adaptation brief. Try the narrow preview and local theme controls before connecting real data, and use Reset to return an example to its initial state. Keep layout changes in class utilities where appropriate; follow the Component Styles Guide for hierarchy and the Theming Guide for shared surfaces and colors. The Accessibility Notes explain what to preserve when making those changes.

Payments Demo

Follow How the Table Features Interact. The payments example combines filtering, sorting, column visibility, row selection and pagination around the same records. Read data-table-payments-demo.tsx to see how those states work together before copying only the visible table markup.

Use stable record identifiers, define the scope of bulk actions, and replace demonstration handlers with your own data-loading and mutation logic before shipping.

src/components/DataTableExample.tsx3 lines
import { PaymentsDataTableDemo } from "./data-table-payments-demo";

export const Example = () => <PaymentsDataTableDemo />;

Basic Table

Build the Readable Structure First. Start with static column headings and mapped rows when the task only needs a readable record list. This establishes the relationship between each header and cell before adding stateful sorting, filtering or pagination.

Keep actions in clearly named controls, provide stable row keys, and compare Table when a static dataset does not need a larger table-state abstraction.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Empty State

Explain Why There Are No Rows. Render one body row with a spanning colSpan cell when there are no records to display. The table headers remain visible, while the message explains whether the collection is empty or the current filter found nothing.

Span the full set of visible columns, offer an appropriate next step, and keep the table's surrounding controls useful for recovering results.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width
API reference

Props and Data

Configure Data Table using the contracts below. Read the documented options alongside the Source Definitions to understand which values your application supplies and which details the component owns. Start with a prop or helper, then follow its type link to inspect the declaration without leaving the page.

Props, slots and variants for this component.

API reference
Your API, from source

Type cards are extracted from this checkout’s TypeScript source at build time. Props inherited through HTMLAttributes, Omit or variant helpers remain references in those declarations; their fields are not flattened here. Match the reference to your installed version, and check a package’s exports before writing an import type. A type exported by a source file is not necessarily re-exported by @kamod-ch/ui.

Component Props

Read each option with its owning component. The
marker identifies required fields verified in that declaration. A ? means a field can be omitted; it does not promise a fallback value. Existing documented defaults remain alongside the descriptions. For callbacks, check the argument and return types before connecting your own state or services.
@kamod-ch/ui/data-table1.7 KB min · 0.6 KB gzipSignals: none

DataTable

DataTableProps

DataTable documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildDataTableProps

Configure children for DataTable. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
chrome
booleanDataTableProps

When true (default), wraps the table in `overflow-hidden rounded-md border` like shadcn data tables. Set false if you already provide an outer chrome or use a bare `<Table>`.

Default
true
class
string | SignalLike<string | undefined>DataTableProps

Configure class for DataTable. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

Data Type Reference

Expand a card to inspect and copy the exact declaration. The code header identifies its repository file; follow imported or inherited types in the Implementation Source when you need the complete dependency chain. Required-field summaries cover fields declared directly in that type. Source-only helpers and inferred schema outputs describe the local implementation, not additional props you can pass to every component.

DataTable Props

2 declared fields
DataTableProps
Exported Source Declaration from DataTable.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of DataTableProps before adapting it.

Accessibility

DataTable is a composition of table content and application controls. Filtering, sorting, selection and pagination require accessible state in the resulting UI; using the component does not automatically announce every dataset change.

Take the Next Useful Step

You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.

Connect the Foundation

Return to Choose and Compose Components to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.

Build the Surrounding Screen

Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.

Make the Result Hold Up

Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.

Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.