Patterns

Data table — looks

striped for long scans · cards for few, rich rows · minimal inside cards and drawers.

$60.00
$73.75
$87.50
$101.25
$115.00
1–5 of 24
1 / 5

Import#

Everything comes from the package root. The example above uses:

your-component.tsx
import { type ColumnDef, DataTable, Money, Segmented, StatusBadge } from "@waveinno/ui";

Props#

Read from the source of this version, so they match the code exactly.

<DataTable>

src/components/patterns/data-table.tsx
PropTypeDefaultDescription
columnsrequiredColumnDef<T, unknown>[]—
datarequiredT[]—
getRowIdrequired(row: T) => string—
onRowClick(row: T) => void—
activeIdstring | null—Row currently shown in the drawer — highlighted, not navigated to.
searchPlaceholderstring"Search…"
pageSizenumber12
footerReact.ReactNode—Rendered in <tfoot>: totals turn a table into a report (§8).
emptyStateReact.ReactNode—
savedViewsSavedView[][]
toolbarExtraReact.ReactNode—
exportNamestring"waveinno-export"
defaultFiltersFilterStateEMPTY_FILTERSFilters to start with (e.g. from the URL).
onFiltersChange(filters: FilterState) => void—Told every time the filters change — save them, or send them to the API.
manualFilteringbooleanfalseThe server filters: rules are shown and reported but rows are not filtered here.
filterLabelsPartial<FilterLabels>—
variant"default" | "striped" | "bordered" | "cards" | "minimal""default"The look: `default` (hairline rows), `striped` (zebra, for long scans), `bordered` (a spreadsheet grid — the one for editing), `cards` (every row a floating card, for few, rich rows), `minimal` (no frame, inside cards and drawers).
onCellEdit(row: T, columnId: string, value: string) => void | Promise<void>—Save an edited cell. Return a promise to show a spinner; reject to keep the editor open.
onBulkEdit(rows: T[], columnId: string, value: string) => void | Promise<void>—Save one value into many rows (the bulk bar's Edit). Without it, the table calls `onCellEdit` once per selected row.
getRowLabel(row: T) => string—Name of a row in confirmations ("Delete these 3: …"). Defaults to the row id.
onBulkDelete(rows: T[]) => void | Promise<void>—Delete the selected rows (the bulk bar's Delete, after a confirmation).
bulkActions(rows: T[], clear: () => void) => React.ReactNode—Extra buttons in the bulk bar, e.g. Assign or Archive. `clear` empties the selection.
classNamestring—

<Money>

src/components/patterns/money.tsx
PropTypeDefaultDescription
valuerequirednumber | null | undefined—
compactboolean—
classNamestring—
decimalsnumber—Override the currency's decimals — whole-number prices read cleaner.
symbolstring—Escape hatch for a figure explicitly stated in another currency.

<Segmented>

src/components/ui/segmented.tsx
PropTypeDefaultDescription
valuerequiredT—
onChangerequired(v: T) => void—
optionsrequiredSegmentedOption<T>[]—
classNamestring—
ariaLabelstring—
variantkeyof typeof TRACK"pill"
sizekeyof typeof SIZES"sm"
fullWidthbooleanfalseStretch to the container, options sharing the width equally.

<StatusBadge>

src/components/ui/badge.tsx
PropTypeDefaultDescription
labelrequiredstring—
toneTone"neutral"
variant"soft" | "solid" | "outline" | "dot" | "gradient" | "live"—
classNamestring—

Install#

If the project does not have the package yet, add it, then follow the setup for Next.js or Vite once.

$ npm install @waveinno/ui