Skip to main content

readonly

Switches the whole form to a non-editable view. Visible editable items are replaced with read-only renderers and change diffing is disabled.

Usage

readonly?: boolean;

Default: false.

Read-only mode is applied after batch and section visibility is resolved. Each visible item renders through the built-in "readonly" handler unless a read-only variant was registered for its comp via registerEditorItem(type, component, { readonly: true }). Booleans print as Yes/No, options resolve to their label, Date values are formatted, and empty values are skipped. When none of the fields hold data, a localized "No data" overlay is shown.

Example

import { Editor } 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 };

<Editor items={items} values={values} readonly={true} topBar={false} />