Skip to content
Data TableAPI Reference

Cell virtual-list options

comins-table@0.2.2React

type: "virtual-list" renders multiple items in a cell; it is unavailable in headers. List selection, expansion, and search are temporary and may reset when table virtualization recreates the cell.

props Default Behavior
itemHeight 28px Item height, minimum 1
limit 5 Initial preview count, minimum 1
height itemHeight × 5 Bounded expanded scroll height; number or CSS length
more false true renders the overflow … as an expand button
searchable false Shows search when true and this row alone is selected

More first selects the row exclusively, then expands the list. With more false, selecting the row exclusively also virtualizes an overflowing list. Item clicks select the row; Ctrl/Cmd toggles it and Shift selects a visible row range. Enter/Space follow the same rules. The search value differs from the value in item-click events.

Expand More and search. The visible list changes while the 12 source items remain unchanged.

type: "virtual-list";

Required virtual-list discriminator.

items: CominsVirtualListItems<TPayload>;

Required item array or cell-payload resolver. Keep value unique within the list.

props?: CominsTableComponentProps<TPayload, React.HTMLAttributes<HTMLDivElement> & {
height?: number | string;
itemHeight?: number;
limit?: number;
more?: boolean;
searchable?: boolean;
}>;

Div HTML attributes plus height/itemHeight/limit/more/searchable above. Accepts an object or resolver.

searchFilter?: (payload: CominsVirtualListSearchFilterPayload) => boolean;

Default search performs case-insensitive substring matching on label text. A custom function receives item, itemIndex, and search text value, returning boolean.

onClickItem?: (payload: TPayload & {
event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>;
item: CominsVirtualListItem;
itemIndex: number;
value: CominsComponentPrimitiveValue;
}) => void;

Emits item/itemIndex/selected item.value plus cell payload. event is MouseEvent or KeyboardEvent.

onContextMenuItem?: (payload: TPayload & {
event: React.MouseEvent<HTMLButtonElement>;
item: CominsVirtualListItem;
itemIndex: number;
value: CominsComponentPrimitiveValue;
}) => void;

Item context-menu event. Call event.preventDefault() when showing a custom menu.

value: CominsComponentPrimitiveValue;

Required string/number/boolean item identity.

label: React.ReactNode;

Required display content and default search target. Complex ReactNodes may not yield searchable text.

data?: TItem;

Optional application data attached to the item. Does not automatically edit table data.

disabled?: boolean;

Default false. Prevents item activation.

searchText?: string;

Present in the published type, but 0.2.0 default search does not read it. Use item.searchText explicitly in searchFilter if needed.

item: CominsVirtualListItem;

Original item being tested.

itemIndex: number;

Index in the original items array before filtering.

value: string;

Current search-input string, distinct from item.value.

export type CominsVirtualListItems<TPayload> = Array<CominsVirtualListItem> | ((payload: TPayload) => Array<CominsVirtualListItem>);

Array or item resolver receiving the cell payload.