DevExtreme jQuery/JS - Built-In Controls

Controls on the toolbar manage the content. Built-in controls include buttons and select boxes.

Buttons apply single-choice formats to the text or perform actions on it. Select boxes apply multiple-choice formats.

DevExtreme HTML5 JavaScript HtmlEditor Toolbar

To add a button to the toolbar, add its name to the items array:

JavaScript
  • $(function(){
  • $("#htmlEditorContainer").dxHtmlEditor({
  • toolbar: {
  • items: [ "bold", "italic", "alignRight", "alignLeft" ]
  • }
  • })
  • })

To add a select box, specify the formatName and formatValues:

JavaScript
  • $(function(){
  • $("#htmlEditorContainer").dxHtmlEditor({
  • toolbar: {
  • items: [{
  • formatName: "header",
  • formatValues: [1, 2, 3, false]
  • }, {
  • formatName: "align",
  • formatValues: ["left", "right", "center"]
  • }]
  • }
  • })
  • })

Customize Built-In Controls

To customize a button, assign its name to the formatName option and specify button options in the options object:

JavaScript
  • $(function(){
  • $("#htmlEditorContainer").dxHtmlEditor({
  • toolbar: {
  • items: [{
  • formatName: "clear",
  • options: { icon: "clear", type: "danger" }
  • }, // ...
  • ]
  • }
  • })
  • })

To customize a select box, specify select box options in the options object in addition to the formatName and formatValues options:

JavaScript
  • $(function(){
  • $("#htmlEditorContainer").dxHtmlEditor({
  • toolbar: {
  • items: [{
  • formatName: "size",
  • formatValues: ["11px", "14px", "16px"],
  • options: {
  • width: 150
  • }
  • }, // ...
  • ]
  • }
  • })
  • })
See Also