Editor
EuiMarkdownEditor provides a markdown authoring experience for the user. The component consists of a toolbar, text area, and a drag-and-drop zone to accept files (if configured to do so). There are two modes: a textarea that keeps track of cursor position, and a rendered preview mode that is powered by EuiMarkdownFormat. State is maintained between the two and it is possible to pass changes from the preview area to the textarea and vice versa.
Base editor
Use the base editor to produce technical content in markdown which can contain text, code, and images. Besides this default markdown content, the base editor comes with several default plugins that let you add emojis, to-do lists, and tooltips, which can be configured or removed as needed.
Consider applying the readOnly prop to restrict editing during asynchronous submit events, like when submitting a comment. This will ensure users understand that the content cannot be changed while the comment is being submitted.
Error handling and feedback
The errors prop allows you to pass an array of errors if syntax is malformed. The below example starts with an incomplete tooltip tag, showing this error message by default. These errors are meant to be ephemeral and part of the editing experience. They should not be a substitute for form validation.
Controlling the height
The height prop allows you to control the height of the EuiMarkdownEditor. You can set the height in pixels or pass "full" to allow the EuiMarkdownEditor to fill the height of its container. By default, the autoExpandPreview prop is set to true. This means that the preview height is automatically adjusted to fit all the content and avoid a scrollbar.
You can also control the maxHeight of the editor/preview area. This prop only works when the height is not set to "full".
Customization
You can customize the editor toolbar by passing a custom toolbarProps object. toolbarProps.right allows you to add custom content (like buttons) in the right slot of the toolbar.
Props
EuiMarkdownEditor
Prop | Description and type | Default value |
|---|---|---|
Prop value# |