RichEdit

The RichEdit component is a rich-text editor for Dataverse multi-line text columns. It offers the formatting Dynamics' own rich-text editor offers — fonts and sizes, colors, lists, indents, alignment, links, images and tables — and writes it the way Dynamics writes it, so a document edited in your portal and in a model-driven app looks the same in both. It is drawn with Fluent UI's own controls and follows your theme.

React Blazor

Rich-text columns

A column whose format in Dataverse is Rich text needs nothing extra: ColumnEdit renders a RichEdit for it, with its label, length limit, required level and permissions taken from the column like any other editor.

React Blazor

Any multi-line text column

Use RichEdit directly to edit any other multi-line text column as rich text. Its value is then the document's HTML. Grids and exports show such a column's text without its formatting.

React Blazor

Images

Images can be inserted from the toolbar, pasted or dropped. They are stored as Dynamics stores them, in msdyn_richtextfile records, when the user may create and read those — grant it in your table permissions. Without that permission, an image is kept in the document itself. Set AllowImages to false to turn images off.

React Blazor

Condensed toolbar

Set ToolbarMode to Condensed for an editor with little room, or for short text such as a note: the toolbar then shows only the formatting used most — undo and redo, bold, italic, underline, strikethrough, highlight and text colors, bulleted and numbered lists, and links — and a button at its end that opens it out to every other button, and closes it again. Name other buttons with CondensedToolbarButtons (React: condensedToolbarButtons), a list of RichEditToolbarButton values: the toolbar shows those, in the order the full toolbar draws them. Limit the toolbar itself, full or condensed, to the buttons named in ToolbarButtons (React: toolbarButtons); it limits the buttons, not the formatting, so keyboard shortcuts and pasted text still format. Set DisplayToolbar to false to show no toolbar at all.

React Blazor
React Blazor
React Blazor

Theme

The editor's border, toolbar and focus indicator use Fluent UI's design tokens, so it matches the other editors in light and dark themes and with your accent color. A document's own formatting — its fonts and colors — is shown as written, as Dynamics shows it.

Example

A RichEdit bound to a rich-text column, opened on an example document.

React example Blazor example React TypeScript Razor

Configuration Options

Use the controls below to explore the available properties.

React example Blazor example React TypeScript Razor
UndoRedoCopy formattingFontFont sizeBoldItalicUnderlineStrikethroughHighlight colorText colorBulleted listNumbered listDecrease indentIncrease indentBlock quoteAlign leftAlign centerAlign rightLinkRemove linkSubscriptSuperscriptInsert imageLeft to rightRight to leftRemove formattingInsert table
React Blazor

RichEdit Class

Parameters

Name
Type
Default
Description
AllowImagesbool
True
Whether images may be inserted — from the toolbar, pasted or dropped. Defaults to true.
AutoFitHeightbool
False
Whether the editing area fits its content — from one line up to RichEdit.Rows, then scrolling — rather than always being RichEdit.Rows lines tall. Defaults to false.
ChildContentRenderFragment?
Child content of the component
ColumnName*string
Column logical name to bind the editor to from the table record.
CondensedToolbarButtonsIReadOnlyCollection<RichEditToolbarButton>?
The buttons a condensed toolbar shows (RichEditToolbarMode.Condensed), drawn in the order the full toolbar draws them, whatever order they are named in; the button at its end still opens it out to the rest of RichEdit.ToolbarButtons. Not set or empty, the formatting used most (RichEdit.DefaultCondensedToolbarButtons): undo and redo, bold, italic, underline, strikethrough, highlight and text colors, bulleted and numbered lists, and links.
Descriptionstring?
Description to be displayed in the tooltip.
Disabledbool?
Should the editor be disabled.
DisplayLabelWhenAvailablebool
True
Specifies whether to display a lable if available.
DisplayToolbarbool
True
Whether the formatting toolbar is shown. Defaults to true.
DisplayTooltipWhenAvailablebool
True
Specifies whether to display a tooltip if available.
DisplayValidationErrorMessagebool
True
Should a validation error message be displayed when the component fails validation?
IsVisiblebool
True
Is the editor visible.
Labelstring?
Text to be displayed as a label for the editor.
LabelPositionEditorLabelPosition?
Where the label sits relative to the control. When null (the default) the editor takes the position set on the nearest enclosing SectionColumn, Section or PageLayout, and EditorLabelPosition.Auto when none sets one.
MaxLengthint?
Maximum length of the stored value, formatting included: what the column holds. Resolved from the column's metadata when not set.
MinLengthint?
Minimum number of characters of text — the text, not its formatting.
Placeholderstring?
Shown in the editor while it is empty.
ReadOnlybool?
Should the editor be read-only.
Requiredbool?
Should the value be required.
Rowsint
10
Height of the editing area in lines of text, however much the document fills; longer content scrolls. With RichEdit.AutoFitHeight, the most it grows to. Defaults to 10.
ToolbarButtonsIReadOnlyCollection<RichEditToolbarButton>?
The only buttons the toolbar shows, full or condensed, drawn in the order the full toolbar draws them. A condensed toolbar shows those of RichEdit.CondensedToolbarButtons that are here, and opens out to the rest of these; with none left to show, it has no button to open it out. It limits the buttons, not the formatting: keyboard shortcuts and pasted text still format. Not set or empty, every button is shown.
ToolbarModeRichEditToolbarMode
Full
How much of the toolbar is shown: every button, or the formatting used most with a button that shows the rest (RichEditToolbarMode.Condensed). Defaults to RichEditToolbarMode.Full.
Valuestring?
Gets or sets the editor's value: the column's HTML.
Name: AllowImages
Type: bool
Default: True
Description: Whether images may be inserted — from the toolbar, pasted or dropped. Defaults to true.
Name: AutoFitHeight
Type: bool
Default: False
Description: Whether the editing area fits its content — from one line up to RichEdit.Rows, then scrolling — rather than always being RichEdit.Rows lines tall. Defaults to false.
Name: ChildContent
Type: RenderFragment?
Description: Child content of the component
Name: ColumnName*
Type: string
Description: Column logical name to bind the editor to from the table record.
Name: CondensedToolbarButtons
Type: IReadOnlyCollection<RichEditToolbarButton>?
Description: The buttons a condensed toolbar shows (RichEditToolbarMode.Condensed), drawn in the order the full toolbar draws them, whatever order they are named in; the button at its end still opens it out to the rest of RichEdit.ToolbarButtons. Not set or empty, the formatting used most (RichEdit.DefaultCondensedToolbarButtons): undo and redo, bold, italic, underline, strikethrough, highlight and text colors, bulleted and numbered lists, and links.
Name: Description
Type: string?
Description: Description to be displayed in the tooltip.
Name: Disabled
Type: bool?
Description: Should the editor be disabled.
Name: DisplayLabelWhenAvailable
Type: bool
Default: True
Description: Specifies whether to display a lable if available.
Name: DisplayToolbar
Type: bool
Default: True
Description: Whether the formatting toolbar is shown. Defaults to true.
Name: DisplayTooltipWhenAvailable
Type: bool
Default: True
Description: Specifies whether to display a tooltip if available.
Name: DisplayValidationErrorMessage
Type: bool
Default: True
Description: Should a validation error message be displayed when the component fails validation?
Name: IsVisible
Type: bool
Default: True
Description: Is the editor visible.
Name: Label
Type: string?
Description: Text to be displayed as a label for the editor.
Name: LabelPosition
Type: EditorLabelPosition?
Description: Where the label sits relative to the control. When null (the default) the editor takes the position set on the nearest enclosing SectionColumn, Section or PageLayout, and EditorLabelPosition.Auto when none sets one.
Name: MaxLength
Type: int?
Description: Maximum length of the stored value, formatting included: what the column holds. Resolved from the column's metadata when not set.
Name: MinLength
Type: int?
Description: Minimum number of characters of text — the text, not its formatting.
Name: Placeholder
Type: string?
Description: Shown in the editor while it is empty.
Name: ReadOnly
Type: bool?
Description: Should the editor be read-only.
Name: Required
Type: bool?
Description: Should the value be required.
Name: Rows
Type: int
Default: 10
Description: Height of the editing area in lines of text, however much the document fills; longer content scrolls. With RichEdit.AutoFitHeight, the most it grows to. Defaults to 10.
Name: ToolbarButtons
Type: IReadOnlyCollection<RichEditToolbarButton>?
Description: The only buttons the toolbar shows, full or condensed, drawn in the order the full toolbar draws them. A condensed toolbar shows those of RichEdit.CondensedToolbarButtons that are here, and opens out to the rest of these; with none left to show, it has no button to open it out. It limits the buttons, not the formatting: keyboard shortcuts and pasted text still format. Not set or empty, every button is shown.
Name: ToolbarMode
Type: RichEditToolbarMode
Default: Full
Description: How much of the toolbar is shown: every button, or the formatting used most with a button that shows the rest (RichEditToolbarMode.Condensed). Defaults to RichEditToolbarMode.Full.
Name: Value
Type: string?
Description: Gets or sets the editor's value: the column's HTML.

Events

Name
Type
Description
ValueChangedEventCallback<ColumnValueBase>
Gets or sets a callback that updates the bound value.
Name: ValueChanged
Type: EventCallback<ColumnValueBase>
Description: Gets or sets a callback that updates the bound value.

Methods

Name
Parameters
Type
Description
FocusAsyncTask
Puts the cursor in the editor.
GetValidationErrorsList<string>
Returns validation errors for the current value: the minimum counts the text, the maximum counts what is stored.
OnImageErrorstring fileName
string reason
void
JS → C#: an image the user chose couldn't be inserted. Said under the editor.
OnStateChangedJsonElement state
void
JS → C#: what the toolbar shows changed — the selection moved or its formatting did.
OnValueChangedstring value
Task
JS → C#: the document changed. Carries the value to store, or null when empty.
UploadImageAsyncIJSStreamReference image
string fileName
long size
Task<string>
JS → C#: stores an image the user inserted as a msdyn_richtextfile record, and returns its id — or null when the user may not create one or read it back, and the image is kept in the document instead.
Name: FocusAsync
Type: Task
Description: Puts the cursor in the editor.
Name: GetValidationErrors
Type: List<string>
Description: Returns validation errors for the current value: the minimum counts the text, the maximum counts what is stored.
Name: OnImageError
Parameters: string fileName
string reason
Type: void
Description: JS → C#: an image the user chose couldn't be inserted. Said under the editor.
Name: OnStateChanged
Parameters: JsonElement state
Type: void
Description: JS → C#: what the toolbar shows changed — the selection moved or its formatting did.
Name: OnValueChanged
Parameters: string value
Type: Task
Description: JS → C#: the document changed. Carries the value to store, or null when empty.
Name: UploadImageAsync
Parameters: IJSStreamReference image
string fileName
long size
Type: Task<string>
Description: JS → C#: stores an image the user inserted as a msdyn_richtextfile record, and returns its id — or null when the user may not create one or read it back, and the image is kept in the document instead.