onChange
Fires when an editable field reports a new value, before validation and save.
Usage
onChange?: (ev: {
key: string | number;
value: any;
input?: boolean;
update?: Record<string, any>;
}) => void;
| Field | Type | Description |
|---|---|---|
key | string | number | Changed field key. |
value | any | New value. |
input | boolean | true while the user is still typing (raw input event); absent once the edit is committed (change/blur). |
update | Record<string, any> | Map of all current unsaved values (the editing draft). |
Example
import { Editor } from "@svar-ui/react-editor";
function onChange(ev) {
console.log(`field ${ev.key} changed to ${ev.value}`);
console.log("all unsaved changes", ev.update);
}
<Editor items={items} values={values} onChange={onChange} />;