• Settings
    • Locale
    • Change the locale of the datepicker, schedule and client side validation messages.

      Language
      English
      English
      English
      French
      German
      German
      German
      Italian
      Korean
      Spanish
      Catalan
      Dutch
      Portuguese
      Portuguese
      Arabic
      Arabic
      Bulgarian
      Bangla
      Bosnian
      Czech
      Greek
      Estonian
      Persian
      Finnish
      Danish
      Hindi
      Indonesian
      Icelandic
      Croatian
      Japanese
      Hungarian
      Hebrew
      Georgian
      Central Kurdish
      Khmer
      Kyrgyz
      Kazakh
      Lithuanian
      Latvian
      Malay
      Norwegian
      Polish
      Romanian
      Russian
      Slovak
      Slovenian
      Serbian
      Serbian
      Swedish
      Thai
      Turkish
      Ukrainian
      Uzbek
      Vietnamese
      Chinese
      Chinese
  • Resources

MonacoEditor Theme

MonacoEditor accepts custom style and color themes defined with the Java API or the client-side API of Monaco.

MonacoEditor Tag Documentation

Inline Monaco code editor (no iframe).

NameTypeRequiredDefaultDescription
id String false generated Unique identifier of the component in a namingContainer.
rendered Boolean false generated Unique identifier of the component in a namingContainer.
binding UIComponent false generated An EL expression referring to a server side UIComponent instance in a backing bean.
extender String false Extender script: JavaScript expression that evaluates to an extender instance.
overflowWidgetsDomNode String false Search expression for a component; places overflow widgets inside an external DOM node.

MonacoEditorFramed Tag Documentation

Framed Monaco code editor (iframe).

NameTypeRequiredDefaultDescription
id String false generated Unique identifier of the component in a namingContainer.
rendered Boolean false generated Unique identifier of the component in a namingContainer.
binding UIComponent false generated An EL expression referring to a server side UIComponent instance in a backing bean.
extender String false URL to an extender script loaded into the iframe.
iframeUrlParams Object false Additional URL params added to the iframe URL. Either a Map<String, String> or a String with a JavaScript expression that evaluates to an object representing such a map.
Tag Documentation Widget Source Basic Localization Events Theme Extender Diff Diff Localization Diff Events Diff Theme Diff Extender
Custom Theme

Define a custom style and color theme with the customThemes attribute, then enable it with the theme option of editorOptions. See the example on the Monaco editor homepage. For more fine-grained control use the client-side API via the extender attribute. The custom theme is selected explicitly, so it does not follow the color scheme of the page.

Usage


<style>
    .monacoEditorBox {
        border: 1px solid var(--p-content-border-color);
        min-width: 0;
    }
</style>

<div class="card">
    <h5>Custom Theme</h5>
    <p>
        Define a custom style and color theme with the <code>customThemes</code> attribute, then enable it with the <code>theme</code> option of <code>editorOptions</code>. See the <a href="https://microsoft.github.io/monaco-editor/playground.html#customizing-the-appearence-tokens-and-colors" target="_blank" rel="noopener noreferrer">example on the Monaco editor homepage</a>. For more fine-grained control use the <a href="https://microsoft.github.io/monaco-editor/api/modules/monaco.editor.html#defineTheme" target="_blank" rel="noopener noreferrer">client-side API</a> via the <code>extender</code> attribute. The custom theme is selected explicitly, so it does not follow the color scheme of the page.
    </p>
    <h:form id="formCustomTheme">
        <p:selectOneButton id="type" value="#{monacoEditorController.type}" styleClass="monacoSync">
            <f:selectItem itemLabel="Inline" itemValue="inline" />
            <f:selectItem itemLabel="Iframe" itemValue="framed" />
            <p:ajax process="@form" update="@(.monacoSync)" />
        </p:selectOneButton>

        <h:panelGroup id="monacoEditorWrapper" layout="block" styleClass="monacoEditorBox monacoSync">
            <pe:monacoEditor id="monacoEditor" widgetVar="monacoEditorTheme"
                rendered="#{monacoEditorController.type eq 'inline'}"
                value="#{monacoEditorController.value}"
                editorOptions="#{monacoEditorController.editorOptions}"
                customThemes="#{monacoEditorController.customThemes}"
                width="100%" height="400px"
                autoResize="true"/>

            <pe:monacoEditorFramed id="monacoEditorFramed" widgetVar="monacoEditorFramedTheme"
                rendered="#{monacoEditorController.type eq 'framed'}"
                value="#{monacoEditorController.valueFramed}"
                editorOptions="#{monacoEditorController.editorOptionsFramed}"
                customThemes="#{monacoEditorController.customThemes}"
                width="100%" height="400px"
                autoResize="true"/>
        </h:panelGroup>
    </h:form>
</div>