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.
<RichEdit columnName="ppp_richdescription" /><RichEdit ColumnName="ppp_richdescription" />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.
<ColumnEdit columnName="ppp_richdescription" /><ColumnEdit ColumnName="ppp_richdescription" />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.
<RichEdit columnName="description" /><RichEdit ColumnName="description" />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.
<RichEdit columnName="ppp_richdescription" allowImages={false} /><RichEdit ColumnName="ppp_richdescription" AllowImages="false" />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.
<RichEdit columnName="ppp_richdescription" toolbarMode={RichEditToolbarMode.Condensed} /><RichEdit ColumnName="ppp_richdescription" ToolbarMode="RichEditToolbarMode.Condensed" /><RichEdit columnName="ppp_richdescription"
toolbarMode={RichEditToolbarMode.Condensed}
condensedToolbarButtons={[RichEditToolbarButton.Bold, RichEditToolbarButton.Italic, RichEditToolbarButton.Link]} /><RichEdit ColumnName="ppp_richdescription"
ToolbarMode="RichEditToolbarMode.Condensed"
CondensedToolbarButtons="[RichEditToolbarButton.Bold, RichEditToolbarButton.Italic, RichEditToolbarButton.Link]" /><RichEdit columnName="ppp_richdescription"
toolbarButtons={[RichEditToolbarButton.Bold, RichEditToolbarButton.Italic, RichEditToolbarButton.Underline, RichEditToolbarButton.Link]} /><RichEdit ColumnName="ppp_richdescription"
ToolbarButtons="[RichEditToolbarButton.Bold, RichEditToolbarButton.Italic, RichEditToolbarButton.Underline, RichEditToolbarButton.Link]" />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.
A RichEdit bound to a rich-text column, opened on an example document.
Use the controls below to explore the available properties.
Name | Type | Default | Description |
|---|---|---|---|
AllowImages | bool | True | Whether images may be inserted — from the toolbar, pasted or dropped. Defaults to true. |
AutoFitHeight | bool | 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. |
ChildContent | RenderFragment? | Child content of the component | |
ColumnName* | string | Column logical name to bind the editor to from the table record. | |
CondensedToolbarButtons | IReadOnlyCollection<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. | |
Description | string? | Description to be displayed in the tooltip. | |
Disabled | bool? | Should the editor be disabled. | |
DisplayLabelWhenAvailable | bool | True | Specifies whether to display a lable if available. |
DisplayToolbar | bool | True | Whether the formatting toolbar is shown. Defaults to true. |
DisplayTooltipWhenAvailable | bool | True | Specifies whether to display a tooltip if available. |
DisplayValidationErrorMessage | bool | True | Should a validation error message be displayed when the component fails validation? |
IsVisible | bool | True | Is the editor visible. |
Label | string? | Text to be displayed as a label for the editor. | |
LabelPosition | EditorLabelPosition? | Where the label sits relative to the control. When null (the default) the editor takes the position set on the nearest enclosing EditorLabelPosition.Auto when none sets one. | |
MaxLength | int? | Maximum length of the stored value, formatting included: what the column holds. Resolved from the column's metadata when not set. | |
MinLength | int? | Minimum number of characters of text — the text, not its formatting. | |
Placeholder | string? | Shown in the editor while it is empty. | |
ReadOnly | bool? | Should the editor be read-only. | |
Required | bool? | Should the value be required. | |
Rows | int | 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. |
ToolbarButtons | IReadOnlyCollection<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. | |
ToolbarMode | RichEditToolbarMode | 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. |
Value | string? | Gets or sets the editor's value: the column's HTML. |
AllowImagestrue.AutoFitHeightRichEdit.Rows, then scrolling — rather than always being RichEdit.Rows lines tall. Defaults to false.ChildContentColumnName*CondensedToolbarButtonsRichEditToolbarMode.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.DescriptionDisabledDisplayLabelWhenAvailableDisplayToolbartrue.DisplayTooltipWhenAvailableDisplayValidationErrorMessageIsVisibleLabelLabelPositionnull (the default) the editor takes the position set on the nearest enclosing EditorLabelPosition.Auto when none sets one.MaxLengthMinLengthPlaceholderReadOnlyRequiredRowsRichEdit.AutoFitHeight, the most it grows to. Defaults to 10.ToolbarButtonsRichEdit.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.Condensed). Defaults to RichEditToolbarMode.Full.ValueName | Type | Description |
|---|---|---|
ValueChanged | EventCallback<ColumnValueBase> | Gets or sets a callback that updates the bound value. |
ValueChangedName | Parameters | Type | Description |
|---|---|---|---|
FocusAsync | Task | Puts the cursor in the editor. | |
GetValidationErrors | List<string> | Returns validation errors for the current value: the minimum counts the text, the maximum counts what is stored. | |
OnImageError | string fileName string reason | void | JS → C#: an image the user chose couldn't be inserted. Said under the editor. |
OnStateChanged | JsonElement state | void | JS → C#: what the toolbar shows changed — the selection moved or its formatting did. |
OnValueChanged | string value | Task | JS → C#: the document changed. Carries the value to store, or null when empty. |
UploadImageAsync | IJSStreamReference image string fileName long size | Task<string> | JS → C#: stores an image the user inserted as a null when the user may not create one or read it back, and the image is kept in the document instead. |
FocusAsyncGetValidationErrorsOnImageErrorOnStateChangedOnValueChangedUploadImageAsyncnull when the user may not create one or read it back, and the image is kept in the document instead.