Loading navigation...
Unify Applications
Logo
Add Components to your Interface
Logo
Code Editor

Code Editor

Logo

2 mins READ

Overview

The code editor component allows users to input code within your application, with options for configuring values and language to fetch inbuilt libraries for the selected language.

Image
Image

Configuring the Code Editor Component

Once the code editor component is added, you can configure its properties through the right-side configuration panel.

Setting Value and Code Input options 

Image
Image
  • Default Value: This correctly sets initial text that appears in the field when it loads. This can serve as an example, placeholder, or suggested entry to guide users on what to input.

  • Editable: This option determines whether users can interact with and modify the code in the editor. When enabled, users can type, delete, and manipulate the content. When disabled, the code becomes read-only, which can be useful for displaying examples that shouldn't be changed.

  • Line Numbers: This feature displays line numbers along the left side of the code editor, making it easier to reference specific parts of the code and navigate through longer snippets.

Language Selection

When a specific programming language is selected:

  1. The editor applies appropriate syntax highlighting for that language

  2. The editor can provide syntax error checking/linting

  3. Autocomplete functionality becomes available with suggestions from the language's standard libraries and syntax

  4. The editor may adjust indentation rules based on the language's conventions

This improves the user experience by providing language-specific assistance while coding.

FAQs

Can I use the code editor as an IDE? 

No, the code editor is just a form of text input and not an actual IDE. You can just pick the value (i.e.) code present in the code editor.

Can I disable editing in the code editor?

Yes, you can disable editing by toggling off the 'Editable' option in the configuration panel to make the editor read-only.

What programming languages are supported in the Code Editor?

The Code Editor supports popular programming languages such as JavaScript, Python, HTML, and more, depending on the configuration.

Does the editor provide syntax error highlighting?

Yes, when a language is selected, the editor performs basic syntax checking and highlighting to assist the user.

Can I pre-fill the editor with example code?

Yes, you can set a default value that appears when the component loads, which is useful for showing examples or templates.

Is there support for autocomplete or suggestions while typing?

Yes, the editor provides autocomplete based on the selected language's standard libraries and syntax.

Can I hide line numbers in the code editor?

Yes, you can toggle the 'Line Numbers' option to show or hide line numbers in the editor interface.