protected boolean shouldBeRendered(FacesContext facesContext, Toolbar component) {
        if (component.getChildCount() > 0) {
            for (UIComponent child : component.getChildren()) {
                if (child.isRendered() && child instanceof ToolbarGroup) {
                    ToolbarGroup toolbarGroup = (ToolbarGroup) child;
                    if (toolbarGroup.getChildren().stream().anyMatch(c -> shouldBeRendered(facesContext, c))) {
                        return true;
                    }
                }
            }
            return false;
        }
        else {
            return FacetUtils.shouldRenderFacet(component.getFacet("left")) || FacetUtils.shouldRenderFacet(component.getFacet("right"));
        }
    }
Determines whether a toolbar should be rendered based on its contents.
<p>
For toolbars with children, checks if any ToolbarGroup child contains renderable components.
For toolbars without children, checks if either the left or right facet should be rendered.

@param facesContext The current FacesContext
@param component The toolbar component to check
@return true if the toolbar has renderable content, false otherwise
primefaces/src/main/java/org/primefaces/component/toolbar/ToolbarRenderer.java