Reflex Cloud - Fast, secure & scalable hosting. One command to deploy.

Editor

An HTML editor component based on Suneditor.

Editor content

EditorOptions

The extended options and toolbar buttons can be customized by passing an instance of rx.EditorOptions for the set_options prop.

Fields

FieldDescription
default_tag Specifies default tag name of the editor. default: 'p' {String}
mode The mode of the editor ('classic', 'inline', 'balloon', 'balloon-always'). default: 'classic' {String}
rtl If true, the editor is set to RTL(Right To Left) mode. default: false {Boolean}
button_list List of buttons to use in the toolbar.

The button_list prop expects a list of lists, where each sublist contains the names of buttons forming a group on the toolbar. The character "/" can be used in place of a sublist to denote a line break in the toolbar.

Some valid button_list options are enumerated in rx.EditorButtonList, seen below.

A custom list of toolbar buttons may also be specified using these names as seen in the following example.

Since this example uses the same state as above, the two editors contents are shared and can be modified by either one.

See the Suneditor README.md for more details on buttons and options.

API Reference

rx.editor

A Rich Text Editor component based on SunEditor. Not every JS prop is listed here (some are not easily usable from python), refer to the library docs for a complete list.

PropType | ValuesDefault
lang
"en" | "da" | ...
name
str
default_value
str
width
str
height
str
placeholder
str
auto_focus
bool
set_options
Dict[Any, Any]
set_all_plugins
bool
set_contents
str
append_contents
str
set_default_style
str
disable
bool
hide
bool
hide_toolbar
bool
disable_toolbar
bool
toggle_code_view
Annotated
toggle_full_screen
Annotated

Event Triggers

See the full list of default event triggers
TriggerDescription
on_blur Fired when the editor loses focus.
on_change Fired when the editor content changes.
on_input Fired when the something is inputted in the editor.
on_load Fired when the editor is loaded.
on_copy Fired when the editor content is copied.
on_cut Fired when the editor content is cut.
on_paste Fired when the editor content is pasted.
toggle_code_viewThe toggle_code_view event handler is called when the user toggles code view. It receives a boolean whether code view is active.
toggle_full_screenThe toggle_full_screen event handler is called when the user toggles full screen. It receives a boolean whether full screen is active.