Days
Hours
Minutes
Seconds
x

New Froala Editor v5.0.0 is here โ€“ Learn More

Skip to content
Froala Documentation

Custom Elements

Custom Dropdown

The following example shows how to create a custom dropdown for the editor:

  1. Define an icon.
  2. Define a dropdown button.
  3. Set a title.
  4. Mark the button as a dropdown.
  5. Specify the icon for the button. If this option is not specified, the button name will be used.
  6. Options for the dropdown.
  7. If present, the options property will be ignored.
    It can be used to define a custom HTML for the dropdown.
    The current context is the editor instance.
  8. Save the dropdown action into undo stack.
  9. Focus inside the editor before callback.
  10. Refresh the button state after the callback.
  11. Add a callback.
    The current context is the editor instance.
  12. Call a function when the dropdown button state might have changed.
    The current context is the editor instance.
  13. Call a function when the dropdown is shown.
    The current context is the editor instance.
  14. console.log (this.selection.element()); } })

Your final code should look like this:

For a working example please refer to the Custom Dropdown Example

Note: Once a command is defined it can be included in the buttons options: imageAltButtons, imageEditButtons, imageInsertButtons, imageSizeButtons, linkEditButtons, linkInsertButtons, tableColorsButtons, tableEditButtons, tableInsertButtons, toolbarButtons, toolbarButtonsMD, toolbarButtonsSM, toolbarButtonsXS, videoEditButtons, videoInsertButtons or videoSizeButtons.

Do you think we can improve this article? Let us know.

Whats on this page hide
Sign up

Download the code by signing up for our newsletter

Sign up

Download the code by signing up for our newsletter

Note: By registering, you confirm that you agree to the processing of your personal data by Froala, Inc. - Froala as described in the Privacy Statement. Froala, Inc. - Froala is part of the Idera group and may share your information with its parent company Idera, Inc., and its affiliates. For further details on how your data is used, stored, and shared, please review our Privacy Statement.