Adding sub sections to a panel plugin config

I’m trying to add subsections to my panel plugin config. I can see a bunch of the built in Grafana plugins are doing this for configuring their legends, tooltips etc. Unfortunately PanelOptionsEditorBuilder.addNestedOptions doesn’t actually create a subsection like I was hoping. Visually there seems to be no difference between using addNestedOptions and just using a bunch of addBooleanSwitch with paths of foo.bar, foo.baz, foo.xyz. Anyone have any ideas?

Well after looking for hours, I found the answer a couple minutes after posting this… Using the category property does exactly what I was looking for. Unfortunately when trying to find this in the documentation, NestedPanelOptions doesn’t actually exist there so I couldn’t find it’s properties.

2 Likes

Hey, and welcome to the plugin dev forums! :wave:

Sounds like you want to set the category for the panel options. You can have multiple subcategories, by adding more elements to the category array, but they’ll be flattened in the UI. Feel free to experiment!

By setting the category property in the options builder:

You’ll get something like this:

1 Like

This is exactly what I was looking for! Thank you Marcus

1 Like