values
The record the editor edits. The editor deep-copies it into a draft whenever the prop changes, so the source object stays untouched until a save. Saved changes are written back through item setters and reported via onSave.
Usage
type TValues = Record<string, any>;
values?: TValues;
Default: {}. Keys are matched to items by each item's key (or keys/getter/setter).
Example
import { Editor, Willow } from "@svar-ui/react-editor";
const items = [
{ comp: "text", key: "name", label: "Name" },
{ comp: "checkbox", key: "admin", label: "Is Admin" }
];
const values = { name: "John Doe", admin: true };
function Demo() {
return (
<Willow>
<Editor items={items} values={values} />
</Willow>
);
}