API index

Everything @umriss-ui/table exports, with its signature. A component's props stand on its own page.

Components

ColumnMenu

ColumnMenu – A menu in which the user shows, hides, reorders and pins the table's columns and picks a grouping (also called a column chooser). Offer it where the table has more columns than everyone needs.

Used on Scenarios, Provider, Column, Width and pinning, Search, Grouping, Tree rows, Toolbar, Toolbar controls, ColumnMenu, View and Server mode.

Export

Export – A button that writes the rows the user sees into a CSV file for a spreadsheet (also called download or export to Excel). Hand the application the text instead where it wants the clipboard or a file of its own.

Used on Scenarios, Provider, Sorting, Search, Grouping, Toolbar, Toolbar controls, Export and Server mode.

Pagination

Pagination – The bar under the table that splits long results into pages, with the page size to choose (also called a pager). The table pages only where one stands; without it every filtered row is shown.

Used on Scenarios, First table, Filter, Pre-filter, Grouping, Toolbar, Toolbar controls, Pagination, Benchmark and Server mode.

Search – A text field that narrows the table to the rows containing what the user types (also called a quick filter or global filter). Put it in the toolbar, or anywhere on the page.

Used on Scenarios, First table, Provider, Formats, Sorting, Search, Filter, Pre-filter, Grouping, Tree rows, Aggregate, Selection, Row appearance, RowDetail, Toolbar, Toolbar controls, Export, View, Pagination, Virtualisation, Benchmark, Server mode, Grid mode and Edits.

Toolbar

Toolbar – The bar above the table that holds its search, column menu and export, shows how many rows match, and carries the bulk actions while rows are ticked (also called a table header bar).

Used on Scenarios, First table, Provider, Column, Width and pinning, Sorting, Search, Filter, Pre-filter, Grouping, Tree rows, Aggregate, Selection, Row appearance, RowDetail, RowActions, Toolbar, Toolbar controls, ColumnMenu, Export, View, Pagination, Virtualisation, Benchmark, Server mode and Edits.

Hooks

useTable

A table over your rows: the hook holds its state - sort, filters, search, grouping, page, selection, column widths -, and the parts it returns are typed at your row, so that a field name in Column is checked by the compiler.

  • rows – All rows in automatic mode; in server mode the page a server delivered for the current view.
  • options – How a row is keyed, the view to start from and the handler that hears every change of it, and in server mode the server's count and the handler that hears every request.
  • Returns The table's state and its parts: Table, Column, VerdictColumn, RowDetail, RowActions, Action and GroupBy. Pass it as of to a part that stands outside the table.
function useTable<Z>(rows: readonly Z[], options: TableOptions<Z>): Table<Z>;

Used on Scenarios, Installation, First table, Provider, Column, Formats, Width and pinning, Presets, Sorting, Search, Filter, Pre-filter, Grouping, Tree rows, Aggregate, Selection, Row appearance, RowDetail, RowActions, Toolbar, Toolbar controls, ColumnMenu, Export, View, Pagination, Virtualisation, Benchmark, Server mode, Grid mode, Edits and VerdictColumn.

useTableSelection

A small headless helper for row selection: it holds the selection as a set and supplies the states for "select all" (including indeterminate). What the selection means in the domain stays the application's business.

function useTableSelection<T extends string | number>(ids: readonly T[]): TableSelection<T>;

Used on Selection.

Functions

column

A column preset that fits every table whose rows carry its field: create it once, outside the component, and spread it into a Column. With more than one field in P, name the field as the second type argument.

function column<P, K extends Field<P> = Field<P>>(preset: ColumnPreset<P, K>): ColumnPreset<P, K>;

Used on Scenarios, First table, Formats, Width and pinning, Presets, Sorting, Filter, Grouping, Tree rows, View, Virtualisation, Benchmark, Server mode, Grid mode and VerdictColumn.

columnFilter

A filter for columns with values of type W and conditions of type B. The compiler accepts it at every column whose value fits, and rejects it otherwise. Create it outside the component, like a preset.

function columnFilter<W, B>(definition: ColumnFilter<W, B>): ColumnFilter<W, B>;

Used on Filter.

rowFilter

A filter over the rows of type Z with conditions of type B. Create it outside the component, like a column filter, and name it in rowFilters.

function rowFilter<Z, B>(definition: RowFilter<Z, B>): RowFilter<Z, B>;

Used on Filter and Toolbar controls.

Types

Absent

A value that is not there: null or undefined.

type Absent = null | undefined;

Used on Column.

ActionProps

Its table stands on RowActions.

AggregateColumn<Z>

A column that carries an aggregate, as the pipeline needs it.

NameTypeDefaultDescription
idrequiredstring—
readrequired(row: Z) => unknown—
aggregaterequiredAggregateKind | OwnAggregate<Z>—

AggregateFor<W, Z>

What a column accepts as aggregate: sums and averages for numbers, the extremes for numbers and points in time, the range for points in time, counts for every value with a text form - or a function of one's own.

type AggregateFor<W, Z> =
  | ([Present<W>] extends [number] ? "sum" | "avg" | "min" | "max" : never)
  | ([Present<W>] extends [Date] ? "min" | "max" | "range" : never)
  | (IsDisplayable<W> extends true ? "count" | "distinct" : never)
  | AggregateFunction<W, Z>;

AggregateFunction<W, Z>

An aggregate of one's own: the values present and the rows of the group - or of the filtered set, in the footer. Its result runs through the column's presentation; undefined means there is none.

type AggregateFunction<W, Z> = (values: readonly Present<NoInfer<W>>[], rows: readonly Z[]) => Present<NoInfer<W>> | undefined;

AggregateKind

The built-in aggregates. range is for points in time: the earliest and the latest.

type AggregateKind = "sum" | "avg" | "min" | "max" | "range" | "count" | "distinct";

AggregateOptions

Its table stands on Aggregate.

Used on Edits.

CellEditorProps<W, Z>

What an editor of one's own receives. The table holds the draft; Enter, Escape and Tab stay the table's, bubbling up from the field.

NameTypeDefaultDescription
valuerequiredW | null—The draft - the cell's value until the field changes it.
commitrequired(value?: W | null) => void—Commits - the draft, or the value given. A picker commits on its pick.
rowrequiredZ—
invalidrequiredboolean—The draft did not validate: the field shows it; the message stands beneath.
labelrequiredstring—The field's name: what is edited, for which row. The FormField around the editor already names a core field by it.

Events

NameTypeDefaultDescription
onChangerequired(value: W | null) => void—Changes the draft.

ColumnBase

Its table stands on Column.

ColumnComponent<Z>

The Column of a table, typed at its row: a field column names a field in value, a computed column a function and an id. What it accepts as aggregate, filter, format and edit follows from the type of its value.

interface ColumnComponent<Z> {
  <W extends number | Absent>(
    props: Computed<Z, W> & { footer: "sum" | "avg"; aggregate?: never; format?: NumberFormat; children?: Presentation<W, Z>; share?: boolean },
  ): ReactNode;
  <W extends number | Absent>(
    props: Computed<Z, W> & {
      aggregate: "sum" | "avg" | "min" | "max" | "count" | "distinct";
      footer?: never;
      share?: boolean;
      format?: NumberFormat;
      children?: Presentation<W, Z>;
    },
  ): ReactNode;
  <W extends Date | Absent>(
    props: Computed<Z, W> & {
      aggregate: "min" | "max" | "range" | "count" | "distinct";
      footer?: never;
      format?: DateFormat;
      group?: DatePeriod;
      children?: Presentation<W, Z>;
    },
  ): ReactNode;
  <W extends Date | Absent>(
    props: Computed<Z, W> & {
      group: DatePeriod;
      aggregate?: "min" | "max" | "range" | "count" | "distinct";
      footer?: never;
      format?: DateFormat;
      children?: Presentation<W, Z>;
    },
  ): ReactNode;
  <W extends number | Absent>(
    props: Computed<Z, W> & { format: NumberFormat; aggregate?: AggregateFunction<W, Z>; share?: boolean; children?: Presentation<W, Z> },
  ): ReactNode;
  <W extends Date | Absent>(
    props: Computed<Z, W> & { format: DateFormat; group?: DatePeriod; aggregate?: AggregateFunction<W, Z>; children?: Presentation<W, Z> },
  ): ReactNode;
  <W>(
    props: Computed<Z, W> & {
      footer?: never;
      format?: never;
      aggregate?: AggregateFunction<W, Z>;
      children: Presentation<W, Z>;
    },
  ): ReactNode;
  <W extends Displayable | Absent>(
    props: Computed<Z, W> & { footer?: never; format?: never; aggregate?: "count" | "distinct" | AggregateFunction<W, Z>; children?: never },
  ): ReactNode;
  <K extends Field<Z>>(props: FieldColumn<Z, K>): ReactNode;
}

ColumnFilter

Its table stands on Filter.

ColumnMenuProps

Its table stands on ColumnMenu.

ColumnPreset<P, K extends Field<P> = Field<P>>

The properties of a column, as column() supplies them.

type ColumnPreset<P, K extends Field<P> = Field<P>> = FieldColumn<P, K>;

Computed<Z, W>

A computed column's props: its value is a function of the row, so it needs an id.

type Computed<Z, W> = ColumnBase &
  ValuePaths<W> & {
    /** The id is required where the value is a function. */
    id: string;
    value: (row: Z) => W;
    /* The two names stand here without a condition on the value type, unlike on
       a field column: the value of a computed column is derived from `value`,
       and a condition over this W is not yet resolved when the overload is
       chosen - `filter="range"` would then leave the whole column untyped. A
       filter of one's own is still checked against the value. */
    /** A filter in the column header: `"list"` offers the values that occur,
        `"range"` two bounds (meaningful only for numbers and points in time), a
        filter from `columnFilter` asks whatever it asks itself. */
    // eslint-disable-next-line @typescript-eslint/no-explicit-any -- the condition belongs to the filter
    filter?: "list" | "range" | ColumnFilter<Present<W>, any>;
    /** Edits the column's cells in place in grid mode - see a field column's `edit`. */
    edit?: "text" | "number" | "select" | "date" | ((editor: CellEditorProps<W, Z>) => ReactNode);
    /** What `edit="select"` offers.
      @default the values that occur */
    editOptions?: readonly Present<W>[];
    /** Checks a draft before it is reported; a message keeps the editor open. */
    validate?: (value: W | null, row: Z) => string | null | undefined;
  };

DateFormat

The names of the standard presentations of a point in time.

type DateFormat = "date" | "time" | "dateTime";

DatePeriod

The span a point in time is grouped by.

type DatePeriod = "day" | "week" | "month" | "year";

Displayable

What can appear as text without children.

type Displayable = string | number | boolean | Date;

EditFor<W, Z>

What a column accepts as edit: the core field for its value - "text" for text, "number" for numbers, "date" for points in time, "select" for text and numbers - or an editor of one's own.

type EditFor<W, Z> =
  | ([Present<W>] extends [string] ? "text" | "select" : never)
  | ([Present<W>] extends [number] ? "number" | "select" : never)
  | ([Present<W>] extends [Date] ? "date" : never)
  | ((editor: CellEditorProps<W, Z>) => ReactNode);

EditOptions<W, Z>

The props a column carries for editing in grid mode (<Table grid>).

NameTypeDefaultDescription
editEditFor<W, Z>—Edits the column's cells in place in grid mode: Enter, F2 or typing starts it, Enter or Tab commits, Escape cancels. The table applies nothing - the edit is reported through the table's onCellEdit.

Shown in: Share a column between tables (Presets), Combine grid mode with groups, pinning and many rows (Grid mode), Edit a comments column (Edits) and 6 more

editOptionsreadonly Present<W>[]the values that occurWhat edit="select" offers.

Shown in: Share a column between tables (Presets), Check an edit before it is reported (Edits), Save a row on purpose (Edits) and 1 more

validate(value: W | null, row: Z) => string | null | undefined—Checks a draft before it is reported: a message keeps the editor open and stands beneath the field, as in a FormField; nothing lets it through.

Shown in: Share a column between tables (Presets), Combine grid mode with groups, pinning and many rows (Grid mode), Check an edit before it is reported (Edits) and 3 more

ExportProps

Its table stands on Export.

Field<Z>

The field names of a row.

type Field<Z> = Extract<keyof Z, string>;

FieldColumn

Its table stands on Column.

FieldCondition<W>

What can be set as a condition on a field: a list of its values, and for numbers and points in time a range as well.

type FieldCondition<W> =
  | ListCondition<W>
  | ([Present<W>] extends [number] ? RangeCondition<number> : [Present<W>] extends [Date] ? RangeCondition<Date> : never);

FilterFor<W>

What a column accepts as filter: "list" for every value with a text form, "range" for numbers and points in time, a filter from columnFilter only where its value type fits.

type FilterFor<W> =
  | (IsDisplayable<W> extends true ? "list" : never)
  | ([Present<W>] extends [number] ? "range" : [Present<W>] extends [Date] ? "range" : never)
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- the condition belongs to the filter; at the column only the value counts
  | ColumnFilter<Present<W>, any>;

FilterInputProps

Its table stands on Filter.

FormatFor<W>

What a column accepts as format: a number format for numbers, a date format for points in time, nothing for every other value.

type FormatFor<W> = [Present<W>] extends [number]
  ? NumberFormat
  : [Present<W>] extends [Date]
    ? DateFormat
    : never;

GroupByBase

Its table stands on Grouping.

GroupByComponent<Z>

A value the table can be grouped by without being a column: no cell, no export, no entry among the columns - only where a grouping is chosen.

interface GroupByComponent<Z> {
  <W extends string | number | boolean | Date | Absent>(
    props: GroupByBase & {
      /** The id is required where the value is a function. */
      id: string;
      value: (row: Z) => W;
      groupValue?: (value: Present<W>) => string | number | boolean | Date | Absent;
      group?: GroupFor<W>;
    },
  ): ReactNode;
  <K extends Field<Z>>(
    props: GroupByBase & {
      /** A field of the row; supplies the id at the same time. */
      value: K;
      id?: string;
      groupValue?: (value: Present<Z[K]>) => string | number | boolean | Date | Absent;
      group?: GroupFor<Z[K]>;
    },
  ): ReactNode;
}

GroupFor<W>

group on a point in time: its rows are grouped by day, ISO week, month or year.

type GroupFor<W> = [Present<W>] extends [Date] ? DatePeriod : never;

GroupingId<Z>

A column or group key the table can be grouped by. The columns stand in the JSX, which the hook does not see: a field name is suggested, any id is taken, and one that nothing carries falls out.

type GroupingId<Z> = Field<Z> | (string & {});

GroupLevel<Z>

One level of the grouping: what a row is grouped by on it.

NameTypeDefaultDescription
idrequiredstring—
valuerequired(row: Z) => unknown—The grouping value - the column's value, or what groupValue or a date period made of it. Absent values form one group of their own.
order(row: Z) => unknown—Where the groups of a key of one's own stand: by the smallest of this over their rows. Bands of a number are named "Small", "Large" and must not stand in the alphabet's order.

IsDisplayable<W>

true where the value present can appear as text without children (Displayable), false otherwise - what decides the filters and aggregates a column offers.

type IsDisplayable<W> = [Present<W>] extends [never]
  ? false
  : [Present<W>] extends [Displayable]
    ? true
    : false;

ListCondition<W>

The condition of a list filter: the chosen values, an absent one as null.

type ListCondition<W> = readonly (Present<W> | null)[];

ModelColumn<Z, K extends string = string>

A column as the model reads it - what sorting, search, hiding and the export need of it, not its presentation.

NameTypeDefaultDescription
idrequiredK—
labelstring—Human-readable label – for the column menu and the CSV header row. Not for the presentation of the header cell: that stays compositional.
value(row: Z) => string | number | null | undefined—The value for sorting and searching. null, undefined and NaN are absent: they stand last in both directions and match no search.
compare(a: Z, b: Z) => number—A comparison of one's own; otherwise by the kind of the value.
searchablebooleanfalseTakes part in the free-text search.
hideablebooleantrueMay the user switch this column away? false for columns that identify the row – without them the table is no longer readable.
resizablebooleanfalseMay the user drag the width? A column whose content fits anyway needs no grip.
widthnumber—Initial width in pixels; without it the browser decides.

NumberField<Z>

The field names whose value is a number or may be absent.

type NumberField<Z> = {
  [K in Field<Z>]: Z[K] extends number | Absent ? K : never;
}[Field<Z>];

NumberFormat

The names of the standard presentations of a number.

type NumberFormat = "percent" | "count" | { decimals: number };

OwnAggregate<Z = never>

An aggregate of one's own: the values present and the group's rows.

type OwnAggregate<Z = never> = (values: readonly unknown[], rows: readonly Z[]) => unknown;

Used on Aggregate.

PaginationProps

Its table stands on Pagination.

Pin

Where a pinned column stands: in the block before or after the others.

type Pin = "start" | "end";

Present<W>

The value without the absence - that is what children gets.

type Present<W> = Exclude<W, Absent>;

Presentation<W, Z>

What a column draws in a cell: the value present and its row.

type Presentation<W, Z> = (value: Present<W>, row: Z) => ReactNode;

Used on Formats.

RangeCondition<W>

The condition of a range filter: both bounds inclusive, each may be absent.

NameTypeDefaultDescription
fromW—
toW—

RowActionsProps

Its table stands on RowActions.

RowAdd

A new row the user saved: every column that edits, by column id.

NameTypeDefaultDescription
valuesrequiredReadonly<Record<string, unknown>>—

Shown in: Keep a list: add, change and delete rows (Edits)

RowAttributes

What a row carries in classes and data attributes.

type RowAttributes = { className?: string } & {
  [data: `data-${string}`]: string | undefined;
};

RowDelete<Z>

A row the user asked to delete, and confirmed.

NameTypeDefaultDescription
rowKeyrequiredstring—

Shown in: Keep a list: add, change and delete rows (Edits), Edit a dense table (Edits)

rowrequiredZ—

RowDetailProps

Its table stands on RowDetail.

RowFilter

Its table stands on Filter.

RowGroup<Z>

The rows of the filtered set that share one grouping value on one level.

NameTypeDefaultDescription
pathrequiredstring—Identifies the group across renders and in the view: the keys of its path, outermost first.
valuerequiredunknown—The grouping value; undefined for the group of absent values.
levelrequirednumber—0 is the outermost level.
rowsrequiredZ[]—
groupsrequiredRowGroup<Z>[]—The groups of the next level; empty on the innermost.
aggregatesrequiredRecord<string, unknown>—Per column id, what its aggregate comes to over this group's rows.

RowSave<Z>

A Row draft the user saved (ADR-0036) - reported, not applied.

NameTypeDefaultDescription
rowKeyrequiredstring—

Shown in: Save a row on purpose (Edits), Check a whole row before it is saved (Edits), Keep a list: add, change and delete rows (Edits) and 1 more

changesrequiredReadonly<Record<string, unknown>>—The columns the draft changed, by column id, with their editors' values.

Shown in: Save a row on purpose (Edits), Check a whole row before it is saved (Edits), Keep a list: add, change and delete rows (Edits) and 1 more

rowrequiredZ—

Shown in: Save a row on purpose (Edits)

Used on Edits.

SearchProps

Its table stands on Search.

SetFilter<Z>

Sets a condition from outside. Typed at the field of the row, not at the column: the columns stand in the JSX, and the hook does not see that (ADR-0017). An id that is not a field name – a computed column or an id of one's own – takes any condition; through it the condition of a filter of one's own is set as well.

interface SetFilter<Z> {
  <B>(filter: RowFilter<Z, B>, condition: B | null): void;
  <K extends Field<Z>>(column: K, condition: FieldCondition<Z[K]> | null): void;
  <I extends string>(column: I & (I extends Field<Z> ? never : unknown), condition: unknown): void;
}

SortDirection

The direction of one sort level: asc puts the smallest value on top, desc the largest.

type SortDirection = "asc" | "desc";

SortLevel<K extends string = string>

One level of the sort. Several levels act in their order: the second decides only what the first leaves open.

Table<Z>

What useTable returns: the table's state, and its parts typed at the row. Pass it as of to a part that stands outside the table.

NameTypeDefaultDescription
Tablerequired(props: TableProps<Z>) => ReactNode—

Shown in: A first table (Installation), Show a list of services (First table), Search and page from a header of your own (First table) and 118 more

ColumnrequiredColumnComponent<Z>—

Shown in: A first table (Installation), Show a list of services (First table), Search and page from a header of your own (First table) and 118 more

VerdictColumnrequiredVerdictColumnComponent<Z>—

Shown in: Pin columns to both sides (Width and pinning), Read a day's deliveries by depot (Grouping), Carry the worst verdict up (Aggregate) and 5 more

RowDetailrequired(props: RowDetailProps<Z>) => ReactNode—

Shown in: Keep the header and the names in view (Width and pinning), Employees in the detail (Tree rows), Own staff and teams (Tree rows) and 5 more

RowActionsrequired(props: RowActionsProps) => ReactNode—

Shown in: Name the row (Column), Pin columns to both sides (Width and pinning), Select a whole group (Grouping) and 7 more

Actionrequired(props: ActionProps<Z>) => ReactNode—

Shown in: Name the row (Column), Pin columns to both sides (Width and pinning), Select a whole group (Grouping) and 7 more

GroupByrequiredGroupByComponent<Z>—

Shown in: Group by a value that is no column (Grouping), Group twenty thousand rows (Grouping), Read a day's deliveries by depot (Grouping)

rowsrequiredreadonly Z[]—All the rows passed in, including those the pre-filter does not admit. from TableSnapshot

Shown in: Search and page from a header of your own (First table)

filteredrequiredreadonly Z[]—The filtered set: what the pre-filter admits and search and filters leave, across all pages. from TableSnapshot

Shown in: Select rows (Selection), Scroll twenty thousand rows (Virtualisation)

visiblerequiredreadonly Z[]—What is rendered right now: the page or the window. from TableSnapshot

Shown in: Scroll twenty thousand rows (Virtualisation)

pagerequirednumber—The page shown, from 1. Without Pagination always 1. from TableSnapshot

Shown in: Search and page from a header of your own (First table)

pageCountrequirednumber—How many pages the filtered set makes. from TableSnapshot

Shown in: Search and page from a header of your own (First table)

pageSizerequirednumber—Rows per page. from TableSnapshot

Shown in: Search and page from a header of your own (First table)

setPagerequired(page: number) => void—Changes the page, clamped to those that exist. from TableSnapshot

Shown in: Search and page from a header of your own (First table)

setPageSizerequired(size: number) => void—Sets the rows per page; back to page one. from TableSnapshot

Shown in: Search and page from a header of your own (First table)

setSearchrequired(search: string) => void—Sets the search text; back to page one. from TableSnapshot

Shown in: Search and page from a header of your own (First table)

sortrequiredreadonly SortLevel[]—The sort levels, the first one first – only over columns that registered. from TableSnapshot

Shown in: Sort, arrange and export from controls of your own (First table)

toggleSortrequired(column: string, additive?: boolean) => void—Sorts by a column. With additive a level is added instead of replacing the sort. from TableSnapshot

Shown in: Sort, arrange and export from controls of your own (First table)

hiddenrequiredreadonly string[]—The ids of the hidden columns. from TableSnapshot

Shown in: Sort, arrange and export from controls of your own (First table)

toggleColumnrequired(column: string) => void—Hides a column or shows it again. The row header stays. from TableSnapshot

Shown in: Sort, arrange and export from controls of your own (First table)

orderrequiredreadonly string[]—The order of the columns as ids, as the user chose it. from TableSnapshot

Shown in: Sort, arrange and export from controls of your own (First table)

setOrderrequired(order: readonly string[]) => void—Reorders the columns – on header, body and footer at once. from TableSnapshot

Shown in: Sort, arrange and export from controls of your own (First table)

pinnedrequiredReadonly<Record<string, Pin>>—The pinned columns by id - the declared ones until the user chooses. from TableSnapshot

Shown in: Pin and size from controls of your own (Width and pinning)

setPinrequired(column: string, pin: Pin | null) => void—Pins a column to the start or the end, or unpins it with null. from TableSnapshot

Shown in: Pin and size from controls of your own (Width and pinning)

widthsrequiredReadonly<Record<string, number>>—The widths in pixels: those of the columns, and over them the dragged ones. from TableSnapshot

Shown in: Pin and size from controls of your own (Width and pinning)

setWidthrequired(column: string, width: number | undefined) => void—Sets the width of a column; undefined takes it back. from TableSnapshot

Shown in: Pin and size from controls of your own (Width and pinning)

expandedrequiredreadonly string[]—The keys of the expanded rows. from TableSnapshot

Shown in: Open a detail from outside the table (RowDetail)

toggleRowrequired(key: string) => void—Expands a row or collapses it. from TableSnapshot

Shown in: Open a detail from outside the table (RowDetail)

filterrequiredReadonly<Record<string, unknown>>—The conditions of the column filters and row filters by id, in the order in which they were set. Whatever fits no column and no row filter is absent. from TableSnapshot

Shown in: Set a condition from outside the table (Filter)

setFilterrequiredSetFilter<Z>—Sets the condition of a column filter or a row filter; null clears it. Back to page one. A condition that does not fit the kind of the filter – a range on a list filter, a column without a filter, a row filter not in rowFilters – is passed over with a warning in development. from TableSnapshot

Shown in: Set a condition from outside the table (Filter), Filter by a field no column shows (Filter), Rows from a request (Filter) and 5 more

conditionOfrequired<B>(filter: RowFilter<Z, B>) => B | null—The condition of a row filter, as its type - null while it is lifted. from TableSnapshot

Shown in: Filter by a field no column shows (Filter), Rows from a request (Filter), Ask a question over several fields (Filter) and 3 more

selectionrequiredTableSelection<string>—The selection – its own or the one handed in through selection. from TableSnapshot

Shown in: Select rows (Selection), Copy the selection (Export), Scroll twenty thousand rows (Virtualisation) and 3 more

groupingrequiredreadonly string[]—The ids the table is grouped by, the outermost first – only those a groupable column or a group key carries, at most three. from TableSnapshot

Shown in: Group and fold from controls of your own (Grouping)

setGroupingrequired(grouping: readonly string[]) => void—Groups by these columns or group keys; [] ungroups. Back to page one. from TableSnapshot

Shown in: Group and fold from controls of your own (Grouping)

setViewrequired(view: TableView) => void—Goes to a whole view; what it leaves out goes back to where the table starts, and names no column carries fall out. Not reported through onViewChange: two tables kept in step by onViewChange: (v) => other.setView(v) in both directions do not answer each other. A view with the content already shown changes nothing. from TableSnapshot

Shown in: Keep and restore a view (View)

foldedrequiredreadonly string[]—The paths of the folded groups that still occur. from TableSnapshot

Shown in: Group and fold from controls of your own (Grouping)

toggleFoldrequired(path: string) => void—Folds a group or unfolds it. A group of one row does not fold. from TableSnapshot

Shown in: Group and fold from controls of your own (Grouping)

foldAllrequired() => void—Folds every group that has more than one row. from TableSnapshot

Shown in: Fold groups into a summary (Grouping)

unfoldAllrequired() => void—Unfolds every group. from TableSnapshot

Shown in: Fold groups into a summary (Grouping)

branchesrequiredreadonly string[]—Tree rows: the keys of the open branches. from TableSnapshot

Shown in: Open branches from controls of your own (Tree rows)

toggleBranchrequired(key: string) => void—Tree rows: opens a branch or closes it. from TableSnapshot

Shown in: Open branches from controls of your own (Tree rows)

unfoldAllBranchesrequired() => void—Tree rows: opens every branch that has children. from TableSnapshot

Shown in: Open branches from controls of your own (Tree rows)

foldAllBranchesrequired() => void—Tree rows: closes every branch. from TableSnapshot

Shown in: Open branches from controls of your own (Tree rows)

viewrequiredTableView—The part of the state an application can keep; whatever still stands as the options set it up is absent. from TableSnapshot

Shown in: Set a condition from outside the table (Filter), Fold groups into a summary (Grouping), Keep and restore a view (View)

asCsvrequired() => string—The filtered set in the visible columns as text for a spreadsheet - in server mode the page. from TableSnapshot

Shown in: Sort, arrange and export from controls of your own (First table)

selectionAsTextrequired() => string—The selected rows within the filtered set as tab-separated text under a header line - the text Ctrl+C writes. "" with nothing selected. from TableSnapshot

Shown in: Copy the selection (Export)

virtualrequiredboolean—Whether it virtualises. from TableSnapshot

Shown in: Search and page from a header of your own (First table)

rowCountrequirednumber—How many rows the filtered set has - in server mode the server's count. from TableSnapshot

Shown in: Search and page from a header of your own (First table)

serverrequiredboolean—Whether it is in server mode: the rows are one page of a server's. from TableSnapshot

Shown in: Sort, arrange and export from controls of your own (First table)

Used on Scenarios, Installation, First table, Provider, Column, Formats, Width and pinning, Presets, Sorting, Search, Filter, Pre-filter, Grouping, Tree rows, Aggregate, Selection, Row appearance, RowDetail, RowActions, Toolbar, Toolbar controls, ColumnMenu, Export, View, Pagination, Virtualisation, Benchmark, Server mode, Grid mode, Edits and VerdictColumn.

TableInput<Z = unknown, K extends string = string>

The view's state the model computes a table from, beside its rows and columns: search, filter, sort, page, hidden columns, order, grouping, tree.

NameTypeDefaultDescription
filter(row: Z) => boolean—An additional filter beside the free-text search, e.g. a status choice.
sort| SortLevel<K>
| readonly SortLevel<K>[]
| null
—One level or several. A single level means the same as a list holding only it.
pagenumber—1-based; is clamped to the valid range.
pageSizenumber—
hiddenreadonly K[]—Ids of columns switched away. Columns that are not hideable stay.
orderreadonly K[]—The wanted column order. Columns not named follow in their natural order; unknown ids are passed over.
grouping{ levels: readonly GroupLevel<Z>[]; aggregates?: readonly AggregateColumn<Z>[]; folded: ReadonlySet<string>; /** The collation of text keys; the provider's, where there is one. */ compareText?: (a: string, b: string) => number; }—Groups the sorted filtered set; a page then counts lines, not rows.
server{ rowCount: number }—Server mode: the rows are the page a server answered, and rowCount is its filtered set. The model then searches, filters, sorts, groups and pages nothing - it would do it over one page and call that the whole.
treeTreeInput<Z>—Tree rows: the rows are the roots, and these read their children. The model then sorts every level on its own, filters by core's path rule and pages nothing.

TableOptions

Its table stands on First table.

TableProps

Its table stands on First table.

TableRef

What a part without a row type needs from a table – for of.

type TableRef = Omit<TableSnapshot<unknown>, "setFilter" | "conditionOf"> & {
  readonly Table: unknown;
  /** Without a row kind: any id, any condition. */
  setFilter(column: string, condition: unknown): void;
};

Used on First table.

TableRequest<K extends string = string>

The request server mode reports to onRequest: the parts of the view that decide the rows - search, conditions, sort, page and page size - and nothing else, each at its default as well. A server has no default of the table's to fall back on, and a request it has to complete is one it completes wrongly. A width, an order, a pin or a fold is no part of it.

type TableRequest<K extends string = string> = Required<Pick<TableView<K>, "search" | "conditions" | "sort" | "page" | "pageSize">>;

Used on Server mode.

TableSelection<T extends string | number>

What useTableSelection returns: the selected keys and the gestures on them. Give it to useTable as selection when the application holds the selection.

NameTypeDefaultDescription
selectedrequiredReadonlySet<T>—The keys currently selected.

Shown in: Work through the alerts (Scenarios)

isSelectedrequired(id: T) => boolean—

Shown in: Select rows (Selection), Hold the selection yourself (Selection)

togglerequired(id: T) => void—

Shown in: Hold the selection yourself (Selection)

toggleAllrequired() => void—Selects all the keys passed in - or, when all of them are selected already, deselects them. Keys outside them stay as they are.
clearrequired() => void—

Shown in: Hold the selection yourself (Selection), Work through the alerts (Scenarios), Find a late shipment (Scenarios)

allSelectedrequiredboolean—true when every key passed in is selected.
someSelectedrequiredboolean—true when some - but not all - are selected.
countrequirednumber—

Shown in: Select rows (Selection), Hold the selection yourself (Selection), Copy the selection (Export) and 2 more

TableSnapshot

Its table stands on First table.

TableView<K extends string = string>

Search, conditions, sort levels, page, page size, hidden columns, order, dragged widths, the grouping and the pinned columns. Whatever is at its default is absent. The pre-filter never belongs to it: it is a function of the application.

NameTypeDefaultDescription
conditionsReadonly<Record<string, unknown>>—The conditions of the column filters, per column. A condition for a column that does not exist, or whose filter is of another kind, falls out.

Shown in: Ask a question over several fields (Filter), A dispatcher's bar (Toolbar controls), Hand the table one page (Server mode) and 4 more

sortreadonly SortLevel<K>[]—

Shown in: Keep and restore a view (View), Hand the table one page (Server mode), Sort and search on the server (Server mode) and 3 more

pagenumber—

Shown in: Hand the table one page (Server mode), Sort and search on the server (Server mode), Name the values a list filter offers (Server mode) and 2 more

pageSizenumber—

Shown in: Hand the table one page (Server mode), Sort and search on the server (Server mode), Name the values a list filter offers (Server mode) and 2 more

hiddenreadonly K[]—

Shown in: Keep and restore a view (View)

orderreadonly K[]—
widthsReadonly<Record<string, number>>—Column widths the user has dragged, in pixels.
groupingreadonly K[]—The columns and group keys the table is grouped by, the outermost first.
foldedreadonly string[]—The paths of the folded groups. A path that no longer occurs falls out.

Shown in: Fold groups into a summary (Grouping)

branchesreadonly string[]—Tree rows: the keys of the open branches. A key that no longer occurs falls out.
pinnedReadonly<Record<string, Pin>>—The pinned columns, whole, once the user's choice deviates from what the columns declare - {} when every declared pin was undone. A column that does not exist falls out.

Used on View.

ToolbarProps

Its table stands on Toolbar.

ToolbarSize

The size of a toolbar's controls.

type ToolbarSize = "sm" | "md";

TreeInput<Z>

Tree rows for the model: how a row is keyed, how its children are read, and which branches are open.

NameTypeDefaultDescription
keyrequired(row: Z) => string—
childrenrequired(row: Z) => readonly Z[] | undefined—undefined a leaf, an array a branch - the rule of core's reader.
openrequiredReadonlySet<string>—The keys of the open branches.
admit(row: Z) => boolean—The pre-filter: a row it does not admit is gone with its subtree.

ValuePaths

Its table stands on Column.

VerdictBase

Its table stands on VerdictColumn.

VerdictColumnComponent<Z>

The VerdictColumn of a table, typed at its row: a numeric field, or a function with an id, whose value is read against limits and shown with its verdict.

interface VerdictColumnComponent<Z> {
  (props: VerdictBase & { id: string; value: (row: Z) => number | Absent }): ReactNode;
  <K extends NumberField<Z>>(props: VerdictBase & { value: K; id?: string }): ReactNode;
}

Every page of @umriss-ui/table

Getting started

Columns

Finding rows

Grouping

Rows

Around the table

Many rows

Editing

Limits and alarms

API index