Skip to content
Data TableAPI Reference

Built-in component model and payloads

comins-table@0.2.2React

Configure columns[].cell.components and columns[].header.components with types imported from comins-table. Use the supported type discriminators below; put custom React components in renderer.

type Cell Header Reference
input / checkbox / radio / select / toggle Yes Yes Input components
button / progress Yes Yes Buttons and progress
menu No Yes Header menu
virtual-list Yes No Cell virtual list

A cell renderer takes precedence over format and components. Components replace the default value/format content. Cell input/select appear only when that row is the only selected row; otherwise the default value is displayed. A header renderer replaces label and components. Parent group headers have no component slots.

Component props accept an object or a function of the current payload. Update parent data immutably in callbacks. Built-in click/pointer/keyboard handling is isolated from cell/row selection and header sort/move handling. Custom renderers own their event isolation.

align?: CominsComponentAlign;

Default center. Align within the slot using start/center/end.

direction?: CominsComponentDirection;

Default left. Place on the left/right of the value or header label; array order applies within each side.

id?: string;

Defaults to a slot key based on type and array index. Supply stable unique IDs for dynamic insertion/reordering.

definition: CominsTableRuntimeColumn<TData, TValue>;

Normalized runtime column definition. Treat as read-only.

field: string;

Data path read from the source row.

id: string;

Column ID used by sorting, filtering, and layout.

index: number;

Current visible column index, which may differ from the original columns position.

label: React.ReactNode;

The column ReactNode label.

data: TData;

Parent-owned source row. Do not mutate it.

dataIndex: number;

Source-data index; absolute in Viewport mode.

disabled: boolean;

Resolved disabled state for the row.

id: CominsRowId;

Stable business row ID.

index: number;

Current display-row index.

selected: boolean;

Whether the row is selected.

column: CominsComponentColumnPayload<TData, TValue>;

Column payload described above.

row: CominsComponentRowPayload<TData>;

Row payload described above.

selection: {
selectedRowCount: number;
};

selectedRowCount is the number of selected rows; used for input/select and search visibility.

value: TValue;

Raw cell value before format/renderer processing.

column: CominsComponentColumnPayload<TData, TValue>;

Payload for the header column. There is no row field.

layout: {
hidden: boolean;
width?: number;
};

hidden is resolved visibility state; width is the current width and may be undefined.

sort: {
count: number;
direction: CominsSortDirection | null;
enabled: boolean;
priority: number | null;
};

count is total sort-rule count; direction is this column direction or null; enabled reports sort capability; priority is its one-based rank or null.

export type CominsCellComponent<TData, TValue = unknown> = CominsComponentPlacement & CominsCellComponentConfig<TData, TValue>;

Combines placement with a cell-specific type configuration.

export type CominsHeaderComponent<TData, TValue = unknown> = CominsComponentPlacement & CominsHeaderComponentConfig<TData, TValue>;

Combines placement with a header-specific type configuration.

export type CominsTableComponentProps<TPayload, TProps> = TProps | ((payload: TPayload) => TProps);

A props resolver receives the current slot payload and returns React attributes.

export type CominsTableOptions<TPayload> = CominsTableComponentOption[] | ((payload: TPayload) => CominsTableComponentOption[]);

Option array or function deriving options from the current payload.