Documentation
Design
Components
Code

EccUtilsDesignCode Component

2.0.0-alpha.6
<ecc-utils-design-code/>
EccUtilsDesignCode

Overview

The ecc-utils-design-code component is a powerful code editor built on top of the Ace Editor (opens in a new tab). It provides syntax highlighting for over 160 programming languages, automatic language detection from file extensions, and real-time change events.

This component uses Ace Editor v1.35.0 and supports all major programming languages with intelligent syntax highlighting.

Usage

Basic Code Editor

Read-Only Display

Properties

PropertyTypeDefaultDescription
valuestring""The code content displayed in the editor
languagestring"text"Programming language for syntax highlighting
extensionstring""File extension for automatic language detection (overrides language)
disabledbooleanfalseWhen true, makes the editor read-only

value

Controls the content displayed in the code editor. This property is reactive - changes to this property will update the editor content, and when users edit the code, it will emit change events with the new value.

<EccUtilsDesignCode value="console.log('Hello!');" />

language

Specifies the programming language for syntax highlighting. Supports over 160 languages including javascript, python, java, html, css, json, yaml, etc. When not specified, defaults to "text" with no syntax highlighting.

<EccUtilsDesignCode 
  value="def hello(): print('Hello!')" 
  language="python" 
/>

extension

Automatically detects the programming language from file extensions (e.g., .js, .py, .html). This is useful for file-based workflows. If both language and extension are provided, extension takes precedence.

<EccUtilsDesignCode 
  value="const x = 5;" 
  extension="js" 
/>

disabled

When set to true, makes the editor read-only. Users can view and select code but cannot modify it. Perfect for documentation, code examples, or display-only scenarios.

<EccUtilsDesignCode 
  value="const readOnly = true;" 
  disabled={true} 
/>

Events

Event NameReact Event NameDetail TypeDescription
ecc-input-changedonEccInputChanged{ value: string }Fired when the editor content changes

ecc-input-changed

Emitted whenever the user modifies the code content. The event detail contains the updated code value. This allows you to track changes, save content, or update other parts of your application.

<EccUtilsDesignCode 
  value={code}
  onEccInputChanged={(event) => {
    setCode(event.detail.value);
  }}
/>
Elixir Cloud & AAICloud SDKElixir

Released under Apache 2.0 License.

Copyright © 2023-2025 ELIXIR