Skip to content
Data TableAPI Reference

Input and selection components

comins-table@0.2.2React

Configuration and change events for input, checkbox, radio, select, and toggle in cells or headers. Cell input/select appear only for a single selected row. Omitting callbacks does not update application data.

Input typing changes an internal draft. Enter or blur calls onChange then onValueChange when the value differs from the last commit. Blur after Enter does not commit the same value twice. Both callbacks run if provided, so update data in just one of them. props.onChange is not the commit callback. Do not assume built-in Escape cancellation.

select/radio emit a string value even when option.value was a number or boolean. Convert to the business type explicitly. checkbox/toggle emit a boolean checked value. Their immediate visual state is temporary; persist the final value in parent data.

Select a row and edit its name. Parent data stays unchanged while typing; Enter commits once. Role selection, checkbox, toggle, and button use dedicated callbacks without incrementing ordinary cell/row click counters.

type: "input";

Required literal input.

props?: CominsTableComponentProps<TPayload, React.InputHTMLAttributes<HTMLInputElement>>;

Input HTML attributes or resolver. Defaults to an empty string without value/defaultValue. Even numeric inputs emit strings.

onValueChange?: (payload: TPayload & {
value: string;
}) => void;

Emits the committed string. No callback by default; follows the commit timing above.

onChange?: (payload: TPayload & {
event: CominsInputCommitEvent;
value: string;
}) => void;

Emits the commit event and string value before onValueChange. See CominsInputCommitEvent below.

type: "checkbox";

Required literal checkbox.

props?: CominsTableComponentProps<TPayload, React.InputHTMLAttributes<HTMLInputElement>>;

checked/defaultChecked defaults to false. Set input attributes such as disabled and aria-label.

onCheckedChange?: (payload: TPayload & {
checked: boolean;
}) => void;

Emits the new checked value. Omission leaves parent data unchanged.

type: "radio";

Required literal radio.

props?: CominsTableComponentProps<TPayload, React.HTMLAttributes<HTMLDivElement> & {
value?: CominsComponentPrimitiveValue;
}>;

Div HTML attributes and selected value. In cells, omitted value falls back to the raw cell value. Disable items through options[].disabled.

onValueChange?: (payload: TPayload & {
value: string;
}) => void;

Emits the selected option.value as a string.

options: CominsTableOptions<TPayload>;

Required option array or payload resolver. Provide label/value and keep values unique after string conversion.

type: "select";

Required literal select.

props?: CominsTableComponentProps<TPayload, React.SelectHTMLAttributes<HTMLSelectElement>>;

Select HTML attributes or resolver. Bind the parent value through props.value.

onValueChange?: (payload: TPayload & {
value: string;
}) => void;

Emits a string on selection change. No callback by default.

options: CominsTableOptions<TPayload>;

Required option array or payload resolver. Provide label/value and keep values unique after string conversion.

type: "toggle";

Required literal toggle.

props?: CominsTableComponentProps<TPayload, React.ButtonHTMLAttributes<HTMLButtonElement> & {
checked?: boolean;
}>;

Button HTML attributes plus checked, initially false. Supply button content with children.

onCheckedChange?: (payload: TPayload & {
checked: boolean;
}) => void;

Emits the toggled checked boolean. No callback by default.

label: React.ReactNode;

Required displayed option content.

value: CominsComponentPrimitiveValue;

Required string/number/boolean value, emitted as a string by select/radio.

disabled?: boolean;

Default false. Disables the option.

export type CominsInputCommitEvent = React.ChangeEvent<HTMLInputElement> | React.FocusEvent<HTMLInputElement> | React.KeyboardEvent<HTMLInputElement>;

The published union includes Change/Focus/Keyboard events. The current input implementation commits on Enter/blur with Keyboard/Focus events.