API documentation

Class Reference

Complete Tag Helper property reference, service configuration options, and editor command documentation for the RichTextBox ASP.NET Core package.

Tag Helper

<richtextbox> Attributes

All attributes available on the <richtextbox> tag helper element.

Core

AttributeTypeDefaultDescription
idstringautoHTML element ID for the editor instance
namestringrequiredForm field name for the HTML content
asp-forexpression-Model expression for two-way binding
htmlstringemptyInitial HTML content for the editor
classstring-CSS class for the editor wrapper element

Toolbar

AttributeTypeDefaultDescription
toolbarstring"default"Toolbar preset: default, full, basic, ribbon, office, or a custom button string
toolbar-mobilestring"mobile"Toolbar layout for mobile-width screens

Appearance

AttributeTypeDefaultDescription
skinstring"default"Visual skin: default, gray, office2007blue, rounded-corner, blue
widthstring"100%"Editor width (CSS value: px, %, em)
heightstring"300px"Editor height (CSS value)
resize-modestring"both"Resize mode: both, height, none

Content Behavior

AttributeTypeDefaultDescription
paste-modestring"Auto"Paste handling: Auto, Text, Word, Disabled
enter-key-tagstring"p"Tag for Enter key: p, div, br
url-typestring"default"URL processing: default, relative, absolute
read-onlyboolfalseMakes the editor read-only

Context Menu

AttributeTypeDefaultDescription
enable-context-menuboolfalseEnable custom right-click context menu
context-menu-modestring"Default"Menu preset: Default, Simple, Minimal

Statistics & UI

AttributeTypeDefaultDescription
show-tag-listbooltrueShow tag path in the bottom bar
show-statisticsbooltrueShow character/word statistics in the bottom bar

Content Styling

AttributeTypeDefaultDescription
content-css-urlstringbuilt-inURL of a CSS file applied to the content area
content-css-textstring""Inline CSS text applied to the content area
preview-css-urlstringbuilt-inCSS file for the preview window
editor-body-css-classstring""CSS class applied to the editor body element
editor-body-css-textstring""Inline CSS for the editor body element

Dialog Data

AttributeTypeDefaultDescription
image-items-jsonstring[]JSON array of image URLs for the insert image dialog
gallery-images-jsonstring[]JSON array of {url, text} objects for the gallery
html-templates-jsonstring[]JSON array of [name, html] arrays for templates

Autosave

AttributeTypeDefaultDescription
auto-saveboolfalseEnable localStorage draft saving
auto-save-keystringautolocalStorage key for draft isolation
auto-save-delayint600Delay in milliseconds between saves

Validation

AttributeTypeDefaultDescription
max-html-lengthint0 (unlimited)Maximum total HTML characters
max-text-lengthint0 (unlimited)Maximum visible text characters

Services

AddRichTextBox() Options

Configure the RichTextBox services in Program.cs.

PropertyTypeDefaultDescription
UploadWebPathstring"/uploads"Web-accessible path for uploaded files
MaxUploadByteslong4194304Maximum upload file size (4 MB default)
AllowedImageExtensionsstring[].jpg .png .gif .webp .svgAllowed image file extensions
AllowedFileExtensionsstring[].zip .pdf .doc .docx .rtf .txtAllowed non-image file extensions
RequireValidLicensebooltrueRequire valid license file
LicenseNumberstring"30076785"Expected license number

JavaScript

execCommand Reference

Commands available via editor.execCommand(commandName).

Formatting

bold, italic, underline, strike, superscript, subscript, removeformat, formatpainter, changecase

Font & Color

fontname, fontsize, forecolor, backcolor, lineheight, paragraphs, inlinestyle

Alignment

justifyleft, justifycenter, justifyright, justifyfull, ltr, rtl

Lists & Structure

insertorderedlist, insertunorderedlist, indent, outdent, insertblockquote, inserthorizontalrule, inserttable

Links & Media

insertlink, unlink, insertimage, insertgallery, insertvideo, insertdocument, insertanchor, insertimagemap

Insert

insertemoji, insertchars, insertcode, inserttemplate, insertdate, insertbox, insertlayer, insertfieldset

Clipboard

cut, copy, paste, pastetext, pasteword, delete, selectall

View & Tools

code, preview, find, print, fullscreenenter, fullscreenexit, toggleborder, togglemore, help

History

undo, redo, newdoc, save, load, cleancode

AI Toolkit

editor.aiToolkit methods

Enable with enable-ai-toolkit="true". The toolkit namespace hangs off every editor instance at editor.aiToolkit.

MethodDescription
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

window.RichTextEditorStructuredContent

Enable with enable-structured-content="true". The editor gains getJSON() / setJSON(), and the following global helpers become available:

MemberDescription
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

MapRichTextBoxUploads()

Maps the following endpoints in your ASP.NET Core application:

EndpointMethodDescription
/richtextbox/uploadPOSTUpload images and files
/richtextbox/galleryGET/POSTBrowse folders, list images, create folders