Skip to main content

CodeEditor

    The CodeEditor provides a text input field that is specifically designed for editing code. It further offers properties to configure e.g. syntax highlighting, spell checks or line wrapping. Once the editor is focused via the keyboard, the user must press Enter to start editing and Escape to quit editing and return to the keyboard navigation flow.

    CodeEditorProps

    Signature:

    export declare type CodeEditorProps = & ( | );

    CodeEditor.ActionsMenu​

    The CodeEditor.ActionsMenu slot component does not accept any props. Rendering it as a child of CodeEditor enables the built-in copy action, which renders as a button. When you add further actions, such as CodeEditor.Download or custom Menu.* items, the button is replaced with a menu button that contains all of them.

    CodeEditor.Download​

    CodeEditor slot definition for the "Download" action.

    EditorDownloadProps

    NameTypeDefaultDescription
    fileName?

    Name of the downloaded file. If no extension is provided, it is derived from the editor. Both the filename and extension are sanitized to keep only letters, digits, -, and _. If omitted, the editor provides a default file name.

    onDownload?
    () =>

    Callback fired when the download action is triggered.

    Still have questions?
    Find answers in the Dynatrace Community