A customizable React wrapper component built on top of @monaco-editor/react β with default JSON mode.
π JSON mode with built-in validation π¦ Access to internal editor ref
π Codesandbox Example
npm install react-editor-z
# or
yarn add react-editor-zImport the module in the place you want to use:
import CodeEditor from "react-editor-z"; function App() {
return (
<CodeEditor
// language="json"
// value={value}
// onChange={(val) => setValue(val)}
height="240px"
/>
);
}π§ Props
react-editor-z extends EditorProps from @monaco-editor/react.
| Prop | Type | Description |
|---|---|---|
readOnly |
boolean |
If true, the editor will be in read-only mode. |
rawJson |
boolean |
If true, raw JSON is returned in onChange even if invalid. |
style |
React.CSSProperties |
Inline styles applied to the editor container. |
getRefs |
(refsEditor: React.MutableRefObject<any>) => any |
Callback to access internal editor refs. |
onChange |
(value?: string | any, error?: boolean) => any |
Called on content change; includes error flag if JSON parsing fails. |
π License
MIT