2022 Shuffleboard: how to group the widgets programmatically into Wpilib Shuffleboard?

I’m trying to group the widgets in my Shuffleboard. But I’m not able to find a code source in Wpilib Documentation or from any other source.

I want to group the widgets in Shuffleboard that does when I open the Shuffleboard and deploy the code into robot. I like to do that in my code, not through Shuffleboard.

1 Like

I’m going to assume you are using Java (though C++ is similar). Check out the Shuffleboard JavaDocs - there are a few samples at the top that are exactly what you want.

They all start with Shuffleboard.getTab("Example Tab") . This allows you to organize your widgets into a specific tab.

The third example looks like this:

NetworkTableEntry myBoolean = Shuffleboard.getTab("Example Tab")
   .getLayout("List", "Example List")
   .add("My Boolean", false)
   .withWidget("Toggle Button")

It uses getLayout() to create a “list” grouping on that tab, then adds a toggle button to the list.

You can then use the NetworkTableEntry that this call chain returns to set or retrieve data.

You might find Oblog helpful; it wraps the native shuffleboard API with annotations and infers tab layout from code structure.


Isn’t it will group all the widgets in that tab. I want it to only add 3 widgets into a group.

The snippet I posted will add a single “My Boolean” toggle to the “Example List” list. You can repeat that three times for the three widgets you want.

It won’t automatically add other widgets unless you specifically put them in that group as well.

This is C++, but it does a lot with Shuffleboard (from test mode).

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.