Code Editor¶
- class marimo.ui.code_editor(value: str = '', language: str = 'python', placeholder: str = '', theme: Literal['light', 'dark'] | None = None, disabled: bool = False, min_height: int | None = None, *, label: str = '', on_change: Callable[[str], None] | None = None)¶
A code editor.
Example.
code_editor = mo.ui.code_editor()
Attributes.
value
: a string of the code editor contents
Initialization Args.
value
: initial value of the code editorlanguage
: language of the code editor, defaults to"python"
; most major languages are supported, including “sql”, “javascript”, “typescript”, “html”, “css”, “c”, “cpp”, “rust”, and moreplaceholder
: placeholder text to display when the code editor is emptytheme
: theme of the code editor, defaults to the editor’s defaultdisabled
: whether the input is disabledmin_height
: minimum height of the code editor in pixelslabel
: text label for the elementon_change
: optional callback to run when this element’s value changes
Public methods
Inherited from
UIElement
form
([label, bordered, loading, ...])Create a submittable form out of this
UIElement
.Inherited from
Html
batch
(**elements)Convert an HTML object with templated text into a UI element.
center
()Center an item.
right
()Right-justify.
left
()Left-justify.
callout
([kind])Create a callout containing this HTML element.
style
(style)Wrap an object in a styled container.
Public Data Attributes:
Inherited from
UIElement
value
The element’s current value.
Inherited from
Html
text
A string of HTML representing this element.