Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
deepthishi
New Member

Embedding PowerBI report in ReactJS - show/hide a selected tab (report page) based on user role

Hi,

I am working on embedding a power BI report in React JS web application. 

The report has multiple tabs (pages). I have a requirement on the applciation side, to show/hide only the selected tab based on teh user role. How to accomplish this on the application side.

Also, is it possible to show/hide certain sections of the page  based on user role, from within the reactJS applciation?

Thanks for looking into this.

2 REPLIES 2
v-tangjie-msft
Community Support
Community Support

Hi @deepthishi ,

 

To manage the visibility of tabs (pages) in a Power BI report based on user roles, you would typically leverage Power BI's built-in Row-Level Security (RLS) features to control data access. However, controlling the visibility of entire tabs directly based on user roles requires a different approach since RLS doesn't directly control tab visibility.

 

Yes, it is possible to show or hide sections of a page in ReactJS based on user roles. This can be achieved through conditional rendering within your React components. You would typically manage user roles within your application's state or context and then use these to conditionally render different parts of your UI.

Here's a simplified example:

function MyComponent({ userRole }) {
  return (
    <div>
      {userRole === 'admin' && (
        <div>Admin Section</div>
      )}
      {userRole === 'user' && (
        <div>User Section</div>
      )}
    </div>
  );
}

You can refer to the following documents that may be helpful to you: 

How to Navigate Pages Dynamically with RLS? (youtube.com)

Solved: Auto hide report pages/tabs based on user - Microsoft Fabric Community

javascript - React.js Material-UI: Programmatically hide and show tab - Stack Overflow

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Thanks @v-tangjie-msft for the response. So I understand that it may not be possible to direclt control the visisbility of the tab using RLS . So, is it possible to control the visibility of a embedded powerbi Report tab programatelly through react JS? I went through the suggested documnets, but it is still not clear to me. can you please elaborate. Any code samples will help - thank you

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.