Skip to content

DataTable

Data table for the app register. Text left, hairline row rules, money in tabular mono — exact and never rounded up. Below 640px rows stack into labelled pairs rather than scrolling silently.

Prop Type Notes
columns (required) DataTableColumn[]
rows (required) Array<Record<string, React.ReactNode>> One object per row; values are ReactNodes keyed by column key.
foot Record<string, React.ReactNode> Optional totals row (semibold, strong top rule).
caption string
className string

Other props pass through to the root element (React.TableHTMLAttributes<HTMLTableElement>).

Preview

Declarations

TypeScript
export interface DataTableColumn {
  /** Row-object key this column reads. */
  key: string;
  label: React.ReactNode;
  /** Right-aligned, mono, tabular — money, counts, durations. */
  numeric?: boolean;
  /** Mono without right-alignment — ids, model names. */
  mono?: boolean;
}

export interface DataTableProps extends React.TableHTMLAttributes<HTMLTableElement> {
  columns: DataTableColumn[];
  /** One object per row; values are ReactNodes keyed by column key. */
  rows: Array<Record<string, React.ReactNode>>;
  /** Optional totals row (semibold, strong top rule). */
  foot?: Record<string, React.ReactNode>;
  caption?: string;
  className?: string;
}

export interface EstimateProps {
  /** Tooltip: what is unknown. */
  note?: string;
  children?: React.ReactNode;
}

/**
 * Data table for the app register. Text left, hairline row rules, money in
 * tabular mono — exact and never rounded up. Below 640px rows stack into
 * labelled pairs rather than scrolling silently.
 */
export function DataTable(props: DataTableProps): React.JSX.Element;

/** Marks a figure as partial/estimated: value + engraved "+" with tooltip. */
export function Estimate(props: EstimateProps): React.JSX.Element;