mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 21:47:17 +00:00
* [docs]: App Builder Sprint * minor formatting * html and reset query * form styles * minor updates * Components UI/UX style enhancements * table img updates
7 KiB
7 KiB
| id | title |
|---|---|
| code-editor | Code Editor |
The Code Editor component lets users write and edit code directly within the app, with syntax highlighting and formatting for various programming languages. It's ideal for configuring scripts, editing JSON, or working with custom logic in a more developer-friendly interface.
Properties
| <div style={{ width:"100px"}}> Property | <div style={{ width:"100px"}}> Description | <div style={{ width:"135px"}}> Expected Value |
|---|---|---|
| Placeholder | Specifies a hint that describes the expected value. | This field requires a String value. |
| Mode | Specifies the language to be used for the code-editor. | See info below for the list of all supported languages. |
| Show line number | Show or hides line numbers to the left of the editor. | This field expects a boolean value {{true}} or {{false}}. |
:::info
Supporting all commonly used languages.
- APL
- ASN.1
- Asterisk dialplan
- Brainfuck
- C, C++, C#
- Ceylon
- Clojure
- Closure Stylesheets (GSS)
- CMake
- COBOL
- CoffeeScript
- Common Lisp
- Crystal
- CSS
- Cypher
- Cython
- D
- Dart
- Django (templating language)
- Dockerfile
- diff
- DTD
- Dylan
- EBNF
- ECL
- Eiffel
- Elixir
- Elm
- Erlang
- Factor
- FCL
- Forth
- Fortran
- F#
- Gas (AT&T-style assembly)
- Gherkin
- Go
- Groovy
- HAML
- Handlebars
- Haskell
- Haxe
- HTML embedded (JSP, ASP.NET)
- HTML mixed-mode
- HTTP
- IDL
- Java
- JavaScript (JSX)
- Jinja2
- Julia
- Kotlin
- LESS
- LiveScript
- Lua
- Markdown (GitHub-flavour)
- Mathematica
- mbox
- mIRC
- Modelica
- MscGen
- MUMPS
- Nginx
- NSIS
- N-Triples/N-Quads
- Objective C
- OCaml
- Octave (MATLAB)
- Oz
- Pascal
- PEG.js
- Perl
- PGP (ASCII armor)
- PHP
- Pig Latin
- PowerShell
- Properties files
- ProtoBuf
- Pug
- Puppet
- Python
- Q
- R
- RPM
- reStructuredText
- Ruby
- Rust
- SAS
- Sass
- Spreadsheet
- Scala
- Scheme
- SCSS
- Shell
- Sieve
- Slim
- Smalltalk
- Smarty
- Solr
- Soy
- Stylus
- SQL (several dialects)
- SPARQL
- Squirrel
- Swift
- sTeX, LaTeX
- Tcl
- Textile
- Tiddlywiki
- Tiki wiki
- TOML
- Tornado (templating language)
- troff (for manpages)
- TTCN
- TTCN Configuration
- Turtle
- Twig
- VB.NET
- VBScript
- Velocity
- Verilog/SystemVerilog
- VHDL
- Vue.js app
- Web IDL
- WebAssembly Text Format
- XML/HTML
- XQuery
- Yacas
- YAML
- YAML frontmatter
- Z80
Component Specific Actions (CSA)
The following actions of the component can be controlled using the component-specific actions (CSA), you can trigger it using an event or use a RunJS query.
| Action | Description | How To Access |
|---|---|---|
| setValue | Sets the value of the code editor. | components.codeeditor1.setValue('const getRandomNumber = () => Math.floor(Math.random() * 100) + 1') |
Note: If the setValue component specific action is executed using a JavaScript query, you will have to pass the code inside backticks.
Exposed Variables
| Variables | Description | How To Access |
|---|---|---|
| value | Holds the current input value entered by the user in the code editor. | {{components.codeeditor1.value}} |
Additional Actions
| <div style={{ width:"100px"}}> Action | <div style={{ width:"150px"}}> Description | <div style={{ width:"250px"}}> Configuration Options |
|---|---|---|
| Dynamic height | Automatically adjusts the component's height based on its content. | Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression. |
| Tooltip | Provides additional information on hover. Set a display string. | String |
Devices
| <div style={{ width:"100px"}}> Property | <div style={{ width:"150px"}}> Description | <div style={{ width:"250px"}}> Expected Value |
|---|---|---|
| Show on desktop | Makes the component visible in desktop view. | You can set it with the toggle button or dynamically configure the value by clicking on fx and entering a logical expression. |
| Show on mobile | Makes the component visible in mobile view. | You can set it with the toggle button or dynamically configure the value by clicking on fx and entering a logical expression. |
Styles
Container
| <div style={{ width:"100px"}}> Property | <div style={{ width:"150px"}}> Description | <div style={{ width:"250px"}}> Configuration Options |
|---|---|---|
| Visibility | Controls component visibility. | Toggle on or off, or set programmatically using fx. |
| Disable | Locks the component and makes it non-functional. | Toggle on or off, or set programmatically using fx. |
| Border radius | Sets the corner radius of the editor. | Enter a numeric value (default: 6) or set it programmatically using fx. |
| Border color | Sets the border color of the editor. | Select a color from the color picker or set it programmatically using fx. |
| Background | Sets the background color of the editor. | Select a color from the color picker or set it programmatically using fx. |
:::info Any property having fx button next to its field can be programmatically configured. :::