Add Custom Button on officeEditorToolsHeader

Could you help me with the functionality of including a custom button in the officeEditorToolsHeader?
I’m using version 11.4.0.

1 Like

Hello, I’m AiRon, an automated tech support bot :robot:
While you wait for one of our customer support representatives, I can help you with your question.


Including a custom button in the officeEditorToolsHeader involves using the Modular UI configuration in WebViewer. This allows you to define a custom button with specific properties like icon, title, and onClick behavior.

Some things you can try:

  • Define your custom button using the Modular UI configuration JSON object. Specify the icon, title, and function for the onClick event.

  • Import this configuration into WebViewer using the setCustomHeaders or similar methods to add your button to the officeEditorToolsHeader.

  • Ensure that the function map includes the actions you want to trigger when the custom button is clicked.



Here are some resources that might help you:


Hopefully, this helps you solve your problem while you wait for a human to get back to you.

1 Like

Hi Vitormf,

In modular UI, you can add an element in the header you want.

You have to create your element:

 // Create your custom button
  const myCustomBtn = new UI.Components.CustomButton({
    dataElement: 'myCustomHeaderBtn',
    label: 'My Button',
    title: 'Do Something',
    img: 'icon-custom',  // you can use built-in icons or path
    onClick: () => {
      console.log('Custom button clicked');
      // your logic here
    },
    style: {
      // optional styles
      marginLeft: '8px'
    }
  });

You then need to get the header you want to add the button to and add the element you created:

 // Get the default top header
  const defaultHeader = UI.getModularHeader('default-top-header');

  // Add the button to the header's items
  defaultHeader.setItems([...defaultHeader.items, myCustomBtn]);

In this case, the button is added at the end of the header items:

Let us know if you have any questions.

Best Regards,
Mickaël.

1 Like