Button Card Data List Detail Disclosure Divider Field Set Icon Button Icon Icon Select Inline Text Field Label Link Link Select Menu Modal Rich Text Box Section Select Tabs Tag Text Text Field Text Field With Prefix Toggle

Dimsum v2.0.0

An agentic component library for Ruby On Rails.

Only bold and italic are offered here.
rich-text-box.html.erb Copy snippet Copied!
1
<%= render RichTextBoxComponent.new(variant: "ghost", placeholder: "Placeholder", mentions_url: "/preview/mentions") %>

Rich Text Box

A contenteditable editor whose formatting toolbar appears when you select text, in a boxed (primary) or chrome-less (ghost) variant.

Variant
Primary Ghost
Mentions
Disabled
PropTypeDefault
variant `primary` (default, boxed fill) or `ghost` (chrome-less). String "primary"
formats Subset of FORMATS to offer, in toolbar order. `nil` uses the full set; an empty array hides the toolbar. Include "link" for the insert/remove-link controls. Array nil
placeholder Hint shown while the editor is empty. String nil
disabled Renders the editor read-only (not contenteditable). Boolean false
name When set, the editor's content is serialized to semantic HTML — `<p>`/`<ul>`/`<ol>` blocks; `<strong>`/`<em>`/`<s>`/ `<a href>`/`<br>` inline; mention chips preserved verbatim; no other tags or attributes — and mirrored into a hidden input with this `name` so it submits with a form. Omit for a purely presentational editor. String nil
value Initial HTML, used when no content block is given — seeds both the editor and the hidden input. The caller owns sanitizing this markup (it's rendered as-is); legacy markup is normalized to the serialized grammar on connect. String nil
mentions_url When set, typing `@` opens a suggestion menu sourced from `GET <mentions_url>?q=<query>` (expects JSON `[{label, html}]`). Selecting an item inserts its `html` verbatim — an opaque, inert (`contenteditable="false"`) node the consumer provides. Omit for no mention behaviour (the default). String nil
**html_options Any extra HTML attributes (data-*, aria-*, …). Hash —

Contains

  • Button
  • Icon Button
  • Inline Text Field