React HtmlEditor - toolbar

Configures the UI component's toolbar.

Selector: Toolbar
Default Value: null

container

Specifies the container in which to place the toolbar.

When this property is not set, the toolbar is placed in the UI component's container.

See Also

items[]

Configures toolbar items. These items allow users to format text and execute commands.

Selector: Item

The toolbar provides predefined items and supports custom items. To add a predefined item to the toolbar, include it in the items array:

App.js
  • import 'devextreme/dist/css/dx.light.css';
  •  
  • import HtmlEditor, {
  • Toolbar,
  • Item
  • } from 'devextreme-react/html-editor';
  •  
  • export default function App() {
  • return (
  • <HtmlEditor>
  • <Toolbar>
  • <Item name="bold" />
  • <Item name="italic" />
  • <Item name="alignCenter" />
  • <Item name="undo" />
  • <Item name="redo" />
  • </Toolbar>
  • </HtmlEditor>
  • );
  • }

Most of the predefined items are buttons. To customize a button, assign its name to the name property and specify the button options in the options object:

App.js
  • import 'devextreme/dist/css/dx.light.css';
  •  
  • import HtmlEditor, {
  • Toolbar,
  • Item
  • } from 'devextreme-react/html-editor';
  •  
  • const clearFormatOptions = {
  • icon: "clear",
  • type: "danger"
  • };
  •  
  • export default function App() {
  • return (
  • <HtmlEditor>
  • <Toolbar>
  • </* ... */}
  • <Item
  • name="clear"
  • options={clearFormatOptions}
  • />
  • </Toolbar>
  • </HtmlEditor>
  • );
  • }

To use another UI component instead of a button, specify the widget property and configure the UI component in the options object. In this case, you should also implement all the logic.

The toolbar provides a short syntax for implementing a custom drop-down menu with multiple choices. Refer to the name description for more information.

View Demo

multiline

Specifies whether or not items are arranged into multiple lines when their combined width exceeds the toolbar width.

Type:

Boolean

Default Value: true