RE: Ribbon workbench - hide buttons based on selected Tab
                     
                    
                      
                        Hello,
You can do this by adding a Custom Enable Rules to the command of the button.
The custom enable rule is a JS function that will show/hide the button by checking the current tab name :
function isEnabled(formCtx) {
    const currentTab = formCtx.ui.tabs.get().find(t => t.getDisplayState() === "expanded");
    return currentTab?.getName() === "tab_2";
}
Replace tab_2 by your tab name.
Next, you need to refresh the command bar when you switch tabs.
To do this, subscribe to the "tabStateChange" event on the tabs and call a JS function that does :
function refreshRibbon(execCtx) {
    const formCtx = execCtx.getFormContext();
    formCtx.ui.refreshRibbon(false);
}