react-monaco-editor
Monaco Editor for React.
Examples
To build the examples locally, run:
Then open http://localhost:8886
in a browser.
Installation
Using with Webpack
Add the Monaco Webpack plugin monaco-editor-webpack-plugin
to your webpack.config.js
:
Properties
If you specify value
property, the component behaves in controlled mode.
Otherwise, it behaves in uncontrolled mode.
width
width of editor. Defaults to100%
.height
height of editor. Defaults to100%
.value
value of the auto created model in the editor.defaultValue
the initial value of the auto created model in the editor.language
the initial language of the auto created model in the editor.theme
the theme of the editoroptions
refer to Monaco interface IEditorConstructionOptions.onChange(newValue, event)
an event emitted when the content of the current model has changed.editorWillMount(monaco)
an event emitted before the editor mounted (similar tocomponentWillMount
of React).editorDidMount(editor, monaco)
an event emitted when the editor has been mounted (similar tocomponentDidMount
of React).context
optional, allow to pass a different context then the global window onto which the monaco instance will be loaded. Useful if you want to load the editor in an iframe.