Blazorise Code Editor API

Explore the Blazorise Code Editor API reference for parameters, events, methods, and related types.

For examples and usage guidance, see the Code Editor documentation.

API

Parameters

Parameter Description TypeDefault
AriaDescribedBy

Specifies the aria-describedby attribute value.

Remarks

When set, this value is rendered as-is and overrides help and validation message ids generated by Field and Validation.

string
AriaInvalid

Specifies the aria-invalid attribute value.

Remarks

When set, this value is rendered as-is and overrides the validation-derived aria-invalid state.

string
AriaLabelledBy

Specifies the aria-labelledby attribute value.

Remarks

When set, this value is rendered as-is. Some non-labelable controls can otherwise derive it automatically from a parent FieldLabel or FieldsLabel.

string
AriaRequired

Specifies the aria-required attribute value.

Remarks

When set, this value overrides the required-field state resolved from the parent Validation.

boolfalse
Autofocus

Set's the focus to the component after the rendering is done.

boolfalse
ChildContent

Specifies the content to be rendered inside this CodeEditor.

RenderFragmentnull
CompletionItems

Gets or sets completion items.

IReadOnlyList<CodeEditorCompletionItem>null
CompletionProvider

Gets or sets the completion provider.

CodeEditorCompletionProvidernull
CompletionTriggerCharacters

Gets or sets the characters that trigger completion.

IReadOnlyList<string>null
Debounce

Gets or sets whether user-originated value updates are debounced before being sent to .NET.

Remarks

When supplied, this value overrides the global Blazorise debounce option.

boolfalse
DebounceInterval

Gets or sets the debounce interval in milliseconds.

Remarks

When set, this value overrides the global Blazorise debounce interval.

int?null
Diagnostics

Gets or sets diagnostic markers.

IReadOnlyList<CodeEditorDiagnostic>null
Disabled

Add the disabled boolean attribute on an input to prevent user interactions and make it appear lighter.

boolfalse
EditorOptions

Gets or sets additional editor options.

CodeEditorOptionsnull
Feedback

Placeholder for validation messages.

RenderFragmentnull
FormattingProvider

Gets or sets the document formatting provider.

CodeEditorDocumentFormattingProvidernull
Immediate

Gets or sets whether user-originated value updates are sent to .NET while typing.

Remarks

When supplied, this value overrides the global Blazorise immediate option. When disabled, the value is sent on blur.

boolfalse
Language

Gets or sets the editor language.

string
Languages

Gets or sets custom language definitions.

Remarks

Custom language registrations are global to the page. Use one definition per language identifier.

IReadOnlyList<CodeEditorLanguageDefinition>null
ReadOnly

Add the readonly boolean attribute on an input to prevent modification of the input’s value.

boolfalse
Size

Sets the size of the input control.

Size?null
TabIndex

If defined, indicates that its element can be focused and can participates in sequential keyboard navigation.

int?null
Theme

Gets or sets the editor theme.

Remarks

Themes are global. Changing the theme updates every code editor on the page.

string
Value

Specifies the value inside the input field.

TValuenull
ValueExpression

Specifies an expression that identifies the input value.

Expression<Func<TValue>>null

Events

Event Description Type
Blur

The blur event fires when an element has lost focus.

EventCallback<FocusEventArgs>
Blurred

Notifies when the editor loses focus.

EventCallback
ContentChanged

Notifies when user-originated editor content changes.

Remarks

Programmatic value updates do not raise this event.

EventCallback<string>
CustomValidationValue

Used to provide custom validation value on which the validation will be processed with the Validator handler.

Remarks

Should be used carefully as it's only meant for some special cases when input is used in a wrapper component, like Autocomplete or SelectList.

Func<TValue>
Focused

Notifies when the editor gains focus.

EventCallback
FocusIn

Notifies when the input box gains focus.

EventCallback<FocusEventArgs>
FocusOut

Notifies when the input box loses focus.

EventCallback<FocusEventArgs>
KeyDown

Notifies when a key is pressed down while the control has focus.

EventCallback<KeyboardEventArgs>
KeyPress

Notifies when a key is pressed while the control has focus.

EventCallback<KeyboardEventArgs>
KeyUp

Notifies when a key is released while the control has focus.

EventCallback<KeyboardEventArgs>
OnFocus

Notifies when the input box gains or loses focus.

EventCallback<FocusEventArgs>
Ready

Notifies when the editor is initialized.

EventCallback<CodeEditorReadyEventArgs>
ValueChanged

Occurs after value has changed.

EventCallback<TValue>

Methods

Method DescriptionReturnParameters
FormatDocument Formats the current document. Task<bool>
GetDiagnostics Gets the diagnostic markers for the current editor model.
Remarks

Returns a snapshot of the markers currently available. This method does not start or wait for asynchronous language analysis to complete.

Task<IReadOnlyList<CodeEditorDiagnostic>>
GetSelection Gets the current editor selection. Task<CodeEditorSelection>
GetValue Gets the current editor value. Task<string>
Resize Recalculates the editor dimensions to fit its container. Task
RevealLine Reveals the specified line. Taskint lineNumber
SetSelection Sets the current editor selection. TaskCodeEditorSelection selection
SetValue Sets the current editor value. Taskstring value
Focus Sets the focus on the underline element. Taskbool scrollToElement
Revalidate Forces the Validation (if any is used) to re-validate with the new custom or internal value. Task
On this page