Rich Text Editor

NOTE: All editors have a default max-width of "md". Use our Max Width global prop to override this default, as necessary.

Summary
Rails (TipTap)


The Rails rich text editor is a TipTap surface with no React. The UI (toolbar, block-style menu, formatting actions) is rendered with Playbook Rails kits (pb_rails). The editor document is a vanilla TipTap Editor instance; HTML is synced to a hidden <input> so standard Rails forms can submit the value.

How TipTap is loaded (Rails)

  • The kit’s module script (rich_text_editor_rails.js) uses import() with full URLs on esm.sh (e.g. @tiptap/core@2.8.0). esm.sh resolves dependencies server-side, so no <script type="importmap"> is required—this avoids conflicts when the host page already has an import map (e.g. Vite in dev, or another app map) because Firefox only applies one native map.
  • You do not need TipTap in your app’s npm dependencies or Gemfile for this kit; the browser loads modules from esm.sh when the page runs.
  • Ensure CSP allows loading scripts from https://esm.sh (and esm.sh’s redirected module URLs) if you use a strict script-src / connect-src.

Relation to the React implementation

  • Same core: both use TipTap v2 on top of ProseMirror; styling lives in Playbook SCSS (_tiptap_styles.scss) so the editor chrome lines up between platforms.
  • Different shell: Rails uses ERB + Playbook Rails components + inline module script. React uses RichTextEditor / _tiptap_editor.tsx and TipTap wired through the bundled Playbook React package—see Advanced Default for that stack and when you need TipTap installed in your JavaScript bundle.
Rails (TipTap — Simple toolbar)


Simple toolbar (simple: true)

Pass simple: true for a compact toolbar: Bold, Italic, Undo, and Redo (same history controls as the full toolbar—plain buttons, not popovers).

  • No block-style dropdown (no “Paragraph” / headings / lists in the menu).
  • No pb_popover on the toolbar—useful in native <dialog> modals, turbo-loaded panels, or other tight layouts where the full block menu is awkward to position.

The underlying TipTap document still accepts the same HTML as the default Rails editor; simple only changes which toolbar controls are shown.



Available Props

Props Type Values

align_content

enum | responsive
start
end
center
spaceBetween
spaceAround
spaceEvenly

align_items

enum | responsive
start
end
center

border_radius

enum
none
xs
sm
md
lg
xl
rounded

cursor

enum
auto
default
none
contextMenu
help
pointer
progress
wait
cell

dark

boolean
true
false

flex

enum | responsive
auto
initial
0
1
2
3
4
5
6
7
8
9
10
11
12
none

flex_direction

enum | responsive
row
column
rowReverse
columnReverse

flex_wrap

enum | responsive
wrap
nowrap
wrapReverse

justify_content

enum | responsive
start
end
center
spaceBetween
spaceAround
spaceEvenly

line_height

enum
loosest
looser
loose
normal
tight
tighter
tightest

margin_right

array
none
xxs
xs
sm
md
lg
xl

margin_left

array
none
xxs
xs
sm
md
lg
xl

margin_top

array
none
xxs
xs
sm
md
lg
xl

margin_bottom

array
none
xxs
xs
sm
md
lg
xl

margin_x

array
none
xxs
xs
sm
md
lg
xl

margin_y

array
none
xxs
xs
sm
md
lg
xl

margin

array
none
xxs
xs
sm
md
lg
xl

width

string

min_width

string

max_width

string

gap

string | responsive

column_gap

string | responsive

row_gap

string | responsive

number_spacing

enum
tabular

order

enum | responsive
none
first
1
2
3
4
5
6
7
8
9
10
11
12

overflow_x

enum
scroll
visible
hidden
auto

overflow_y

enum
scroll
visible
hidden
auto

overflow

enum
scroll
visible
hidden
auto

padding_right

array
none
xxs
xs
sm
md
lg
xl

padding_left

array
none
xxs
xs
sm
md
lg
xl

padding_top

array
none
xxs
xs
sm
md
lg
xl

padding_bottom

array
none
xxs
xs
sm
md
lg
xl

padding_x

array
none
xxs
xs
sm
md
lg
xl

padding_y

array
none
xxs
xs
sm
md
lg
xl

padding

array
none
xxs
xs
sm
md
lg
xl

position

enum
relative
absolute
fixed
sticky
static

shadow

enum
none
deep
deeper
deepest

text_align

enum | responsive
start
end
left
right
center
justify
justifyAll
matchParent

truncate

enum
none
1
2
3
4
5

vertical_align

enum | responsive
baseline
super
top
middle
bottom
sub
text-top
text-bottom

z_index

enum | responsive
1
2
3
4
5
6
7
8
9
10
max

top

enum | object
xxs
xs
sm
md
lg
xl
xxl

inset

boolean
true
false

right

enum | object
xxs
xs
sm
md
lg
xl
xxl

bottom

enum | object
xxs
xs
sm
md
lg
xl
xxl

left

enum | object
xxs
xs
sm
md
lg
xl
xxl

height

string

max_height

string

min_height

string

hover

object

group_hover

boolean
true
false
Props Type Values Default

advanced_editor

any

advanced_editor_toolbar

boolean
true
false

toolbar_bottom

boolean
true
false

focus

boolean
true
false

input_options

genericobject

inline

boolean
true
false

label

string

extensions

genericobject

name

string

on_change

function

placeholder

string

input_height

enum
sm
md
lg

input_min_height

enum
sm
md
lg

required_indicator

boolean
true
false
false

simple

boolean
true
false
false

sticky

boolean
true
false

template

string

value

string

trix_editor

reactnode

trix_instance

any