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

ParameterDefaultType
AriaDescribedBy—string

Specifies the aria-describedby attribute value.
When set, this value is rendered as-is and overrides help and validation message ids generated by Field and Validation.
AriaInvalid—string

Specifies the aria-invalid attribute value.
When set, this value is rendered as-is and overrides the validation-derived aria-invalid state.
AriaLabelledBy—string

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

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

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

Specifies the content to be rendered inside this CodeEditor.
CompletionItemsnullIReadOnlyList<CodeEditorCompletionItem>

Gets or sets completion items.
CompletionProvidernullCodeEditorCompletionProvider

Gets or sets the completion provider.
CompletionTriggerCharactersnullIReadOnlyList<string>

Gets or sets the characters that trigger completion.
Debouncefalsebool

Gets or sets whether user-originated value updates are debounced before being sent to .NET.
When supplied, this value overrides the global Blazorise debounce option.

When unspecified, uses BlazoriseOptions.Debounce, falling back to false.

DebounceInterval300int?

Gets or sets the debounce interval in milliseconds.
When set, this value overrides the global Blazorise debounce interval.

When unspecified, uses BlazoriseOptions.DebounceInterval, falling back to 300.

DiagnosticsnullIReadOnlyList<CodeEditorDiagnostic>

Gets or sets diagnostic markers.
Disabledfalsebool

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

Gets or sets additional editor options.
FeedbacknullRenderFragment

Placeholder for validation messages.
FormattingProvidernullCodeEditorDocumentFormattingProvider

Gets or sets the document formatting provider.
Immediatetruebool

Gets or sets whether user-originated value updates are sent to .NET while typing.
When supplied, this value overrides the global Blazorise immediate option. When disabled, the value is sent on blur.

When unspecified, uses BlazoriseOptions.Immediate, falling back to true.

Language—string

Gets or sets the editor language.
LanguagesnullIReadOnlyList<CodeEditorLanguageDefinition>

Gets or sets custom language definitions.
Custom language registrations are global to the page. Use one definition per language identifier.
ReadOnlyfalsebool

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

Sets the size of the input control.
When omitted, uses the parent Addons size, then the theme input size, then Size.Default.
TabIndexnullint?

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

Gets or sets the editor theme.
Themes are global. Changing the theme updates every code editor on the page.
ValuenullTValue

Specifies the value inside the input field.
ValueExpressionnullExpression<Func<TValue>>

Specifies an expression that identifies the input value.

Events

EventType
BlurEventCallback<FocusEventArgs>

The blur event fires when an element has lost focus.
BlurredEventCallback

Notifies when the editor loses focus.
ContentChangedEventCallback<string>

Notifies when user-originated editor content changes.
Programmatic value updates do not raise this event.
CustomValidationValueFunc<TValue>

Used to provide custom validation value on which the validation will be processed with the Validator handler.
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.
FocusedEventCallback

Notifies when the editor gains focus.
FocusInEventCallback<FocusEventArgs>

Notifies when the input box gains focus.
FocusOutEventCallback<FocusEventArgs>

Notifies when the input box loses focus.
KeyDownEventCallback<KeyboardEventArgs>

Notifies when a key is pressed down while the control has focus.
KeyPressEventCallback<KeyboardEventArgs>

Notifies when a key is pressed while the control has focus.
KeyUpEventCallback<KeyboardEventArgs>

Notifies when a key is released while the control has focus.
OnFocusEventCallback<FocusEventArgs>

Notifies when the input box gains or loses focus.
ReadyEventCallback<CodeEditorReadyEventArgs>

Notifies when the editor is initialized.
ValueChangedEventCallback<TValue>

Occurs after value has changed.

Methods

MethodReturnParameters
FormatDocumentTask<bool>—

Formats the current document.
GetDiagnosticsTask<IReadOnlyList<CodeEditorDiagnostic>>—

Gets the diagnostic markers for the current editor model.
Returns a snapshot of the markers currently available. This method does not start or wait for asynchronous language analysis to complete.
GetSelectionTask<CodeEditorSelection>—

Gets the current editor selection.
GetValueTask<string>—

Gets the current editor value.
ResizeTask—

Recalculates the editor dimensions to fit its container.
RevealLineTaskint lineNumber

Reveals the specified line.
SetSelectionTaskCodeEditorSelection selection

Sets the current editor selection.
SetValueTaskstring value

Sets the current editor value.
FocusTaskbool scrollToElement

Sets the focus on the underline element.
RevalidateTask—

Forces the Validation (if any is used) to re-validate with the new custom or internal value.