Complete Tag Helper property reference, service configuration options, and editor command documentation for the RichTextBox ASP.NET Core package.
Tag Helper
All attributes available on the <richtextbox> tag helper element.
| Attribute | Type | Default | Description |
|---|---|---|---|
| id | string | auto | HTML element ID for the editor instance |
| name | string | required | Form field name for the HTML content |
| asp-for | expression | - | Model expression for two-way binding |
| html | string | empty | Initial HTML content for the editor |
| class | string | - | CSS class for the editor wrapper element |
| Attribute | Type | Default | Description |
|---|---|---|---|
| toolbar | string | "default" | Toolbar preset: default, full, basic, ribbon, office, or a custom button string |
| toolbar-mobile | string | "mobile" | Toolbar layout for mobile-width screens |
| Attribute | Type | Default | Description |
|---|---|---|---|
| skin | string | "default" | Visual skin: default, gray, office2007blue, rounded-corner, blue |
| width | string | "100%" | Editor width (CSS value: px, %, em) |
| height | string | "300px" | Editor height (CSS value) |
| resize-mode | string | "both" | Resize mode: both, height, none |
| Attribute | Type | Default | Description |
|---|---|---|---|
| paste-mode | string | "Auto" | Paste handling: Auto, Text, Word, Disabled |
| enter-key-tag | string | "p" | Tag for Enter key: p, div, br |
| url-type | string | "default" | URL processing: default, relative, absolute |
| read-only | bool | false | Makes the editor read-only |
| Attribute | Type | Default | Description |
|---|---|---|---|
| enable-context-menu | bool | false | Enable custom right-click context menu |
| context-menu-mode | string | "Default" | Menu preset: Default, Simple, Minimal |
| Attribute | Type | Default | Description |
|---|---|---|---|
| show-tag-list | bool | true | Show tag path in the bottom bar |
| show-statistics | bool | true | Show character/word statistics in the bottom bar |
| Attribute | Type | Default | Description |
|---|---|---|---|
| content-css-url | string | built-in | URL of a CSS file applied to the content area |
| content-css-text | string | "" | Inline CSS text applied to the content area |
| preview-css-url | string | built-in | CSS file for the preview window |
| editor-body-css-class | string | "" | CSS class applied to the editor body element |
| editor-body-css-text | string | "" | Inline CSS for the editor body element |
| Attribute | Type | Default | Description |
|---|---|---|---|
| image-items-json | string | [] | JSON array of image URLs for the insert image dialog |
| gallery-images-json | string | [] | JSON array of {url, text} objects for the gallery |
| html-templates-json | string | [] | JSON array of [name, html] arrays for templates |
| Attribute | Type | Default | Description |
|---|---|---|---|
| auto-save | bool | false | Enable localStorage draft saving |
| auto-save-key | string | auto | localStorage key for draft isolation |
| auto-save-delay | int | 600 | Delay in milliseconds between saves |
| Attribute | Type | Default | Description |
|---|---|---|---|
| max-html-length | int | 0 (unlimited) | Maximum total HTML characters |
| max-text-length | int | 0 (unlimited) | Maximum visible text characters |
Services
Configure the RichTextBox services in Program.cs.
| Property | Type | Default | Description |
|---|---|---|---|
| UploadWebPath | string | "/uploads" | Web-accessible path for uploaded files |
| MaxUploadBytes | long | 4194304 | Maximum upload file size (4 MB default) |
| AllowedImageExtensions | string[] | .jpg .png .gif .webp .svg | Allowed image file extensions |
| AllowedFileExtensions | string[] | .zip .pdf .doc .docx .rtf .txt | Allowed non-image file extensions |
| RequireValidLicense | bool | true | Require valid license file |
| LicenseNumber | string | "30076785" | Expected license number |
JavaScript
Commands available via editor.execCommand(commandName).
bold, italic, underline, strike, superscript, subscript, removeformat, formatpainter, changecase
fontname, fontsize, forecolor, backcolor, lineheight, paragraphs, inlinestyle
justifyleft, justifycenter, justifyright, justifyfull, ltr, rtl
insertorderedlist, insertunorderedlist, indent, outdent, insertblockquote, inserthorizontalrule, inserttable
insertlink, unlink, insertimage, insertgallery, insertvideo, insertdocument, insertanchor, insertimagemap
insertemoji, insertchars, insertcode, inserttemplate, insertdate, insertbox, insertlayer, insertfieldset
cut, copy, paste, pastetext, pasteword, delete, selectall
code, preview, find, print, fullscreenenter, fullscreenexit, toggleborder, togglemore, help
undo, redo, newdoc, save, load, cleancode
AI Toolkit
Enable with enable-ai-toolkit="true". The toolkit namespace hangs off every editor instance at editor.aiToolkit.
| Method | Description |
|---|---|
| setResolver(fn) | Swap the Ask AI / AI Chat resolver (BYOK). Pass null to restore the demo resolver. |
| openDialog(options) | Open the Ask AI dialog. options.presetMode pre-selects a quick action. |
| openChatPanel(options) | Show the docked AI Chat panel; options.focusComposer moves caret to the textarea. |
| openReviewPanel() | Open the AI Review drawer with pending / accepted / rejected suggestions. |
| runQuickAction(id) | Run a built-in quick action by id (proofread, rewrite, shorten, expand, summarize, translate, justify). |
| getSuggestions() | Return the current pending-suggestions array. |
| clearSuggestions() | Remove all pending suggestions from the drawer. |
| saveSuggestionLedger() / loadSuggestionLedger() | Persist or restore the local suggestion ledger. |
| loadRemoteSuggestionLedger() / refreshRemoteReviewState() | Sync the drawer with a server-backed review log. |
Structured content bridge
Enable with enable-structured-content="true". The editor gains getJSON() / setJSON(), and the following global helpers become available:
| Member | Description |
|---|---|
| editor.getJSON() | Export the current document as a semantic JSON value. |
| editor.setJSON(value) | Replace the editor document with a semantic JSON value. |
| fromMarkdown(md) | Parse Markdown to a semantic JSON document. |
| toMarkdown(value) | Render a semantic JSON document (or editor HTML) to Markdown. |
| renderHTML(value) | Produce sanitized static HTML without mounting a live editor. |
| validateStructuredContent(value) | Return { valid, issues[] } against the structured-content schema. |
| parseStructuredContentHtml(html) | Parse an HTML fragment into the semantic JSON model. |
| serializeStructuredContent(value) | Serialize a semantic JSON document back to an HTML fragment. |
Endpoints
Maps the following endpoints in your ASP.NET Core application:
| Endpoint | Method | Description |
|---|---|---|
| /richtextbox/upload | POST | Upload images and files |
| /richtextbox/gallery | GET/POST | Browse folders, list images, create folders |