How to Create a Collapsible Matrix in Streamlit (Like in Power BI)?

Hello,

I’m working on a project in Streamlit and would like to replicate a feature similar to the collapsible matrix (or drill-down matrix) that we often see in Power BI. In Power BI, you can create a matrix visualization with expandable/collapsible row hierarchies, which is incredibly handy when dealing with large datasets organized by categories, subcategories, etc.

I want an interactive table or matrix in Streamlit with the ability to expand/collapse different levels of detail.

Does anyone have a solution?