Can I add custom controls into Confluence Addon PropertyPanel? Edited

Hi! I found the info about how to customize PropertyPanel with user buttons.

Unfortunatelly, the example shows only the basic staff - how to add a simple button and how to add event listener to it.

But I saw some pictures, where developers add buttons with images, and even another controls, such as checkboxes, text inputs and delimiters.

Does onpremise Confluence support this functionality?

1 answer

1 accepted

Solve it.

The correct answer is:

  1. Register panel initialization through
  2.  Inside handler the first patameter would be macro placeholder, and teh second is buttons array. If you want to modify the existing button with custom HTML, you could just add 'html' property to one of the object, like this 
    buttons[1].html = '<input type="text" />';
    Or, you can even insert new buttons structure into array.
  3. If you want to bind event handlers to your custom controls, register window event handler to listen for created panel event.
    $(window).on('', function () {
    //work with DOM controls here

Summary function code could look like this:

AJS.Confluence.PropertyPanel.Macro.registerInitHandler(function(macroPlaceholder, buttons) {
 //Make what you want with the buttons array. Add or set 'html' property to any custom html you want.
 buttons[1].html = '<input id="PropertyPanelCustomInput" type="text" />';
 $(window).once('', function () {
//Add any event handlers to you custom controls here
$('PropertyPanelCustomInput').on('change', function() {
//Yeah, great. Now I know how to do that!
}, 'myplugin');

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Published 10 hours ago in Confluence

Think you know shares vs. @mentions in Confluence? Take this collab quiz.

To anyone who doubts that Atlassians are a little too obsessed with collaboration, and tools related thereto, let me describe a recent discussion we had (which took place on our internal Confluence, ...

91 views 2 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you