Skip to main content

Skeletons.RichText

A rich text editor or viewer — supports both editable and read-only modes, inline formatting, auto-linking, and tag support. Use it for notes, documents, and any content that requires formatted text input.


Signature

// Full object form
Skeletons.RichText(props, style?)

// Shorthand — string content
Skeletons.RichText("My text")

// Shorthand — string content + class name
Skeletons.RichText("My text", "my-class")

Common Props

PropTypeDescription
contentStringInitial text content. Defaults to "" if omitted
classNameStringCSS class(es) to apply
sys_pnStringNamed part — enables onPartReady and ensurePart
nameStringModel key this editor is bound to
roleStringEditor role — e.g. "editor" for write mode
modeStringInteraction mode — e.g. "interactive"
readwriteNumber1 to enable editing
autofocusNumber / BooleanFocus the editor on render
placeholderStringPlaceholder text shown when empty
serviceStringService triggered on submit or raise
autolinkNumber1 to automatically detect and linkify URLs
tagsAnyTag configuration for tagging support
uiHandlerWidgetRoutes interaction events to onUiEvent

Examples

Skeletons.RichText({
className: `${fig}__editor`,
sys_pn: "text-content",
name: "content",
role: "editor",
readwrite: 1,
autofocus: 1,
autolink: 1,
placeholder: LOCALE.MY_PLACEHOLDER,
service: "raise",
tags,
});

Interactive viewer with initial content

Skeletons.RichText({
className: `${fig}__content`,
sys_pn: "content",
name: "content",
content: ui.mget("content"),
mode: "interactive",
autofocus: ui.mget("autofocus"),
placeholder: ui.getPlaceholder(),
service: "submit",
});