# Hide Columns Based on User Role

> Please note that this is now available as a plugin for easier installation. While you can use this document as a reference, the recommended method to add…

Source: https://tadabase.com/docs/snippets/hide-columns-based-on-user-role  
Status: Not yet re-checked. Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.

> **Warning:** Please note that this is now available as a plugin for easier installation. While you can use this document as a reference, the recommended method to add this functionality is through the plugin installation wizard. Learn more about plugins [here](https://tadabase.com/docs).

![Screenshot for “Hide Columns Based on User Role”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-09/scaled-1680-/2022-09-16_15-43-35.png)

This solution involves hiding columns based on the role of the logged-in user. This may be useful if some roles do not need to view certain columns on your table component.

> **Warning:** Please note that this solution hides the value from the page so it can still be accessed if a user has some HTML knowledge. If the column must be secured from view for a specific role, we recommend creating separate secure pages per role to ensure that your data remains appropriately secure.

**Step 1**

**Ensure your data table is set up to connect to the user roles.**

![Screenshot for “Hide Columns Based on User Role”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-09/scaled-1680-/2022-09-16_15-48-54.png)

**Step 2**

**Add the CSS class of "role-hide" to the column you wish to hide.**

![Screenshot for “Hide Columns Based on User Role”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-09/scaled-1680-/2022-09-16_15-52-54.png)

**Step 3**

**Get your component ID by hovering over the info icon.**

![Screenshot for “Hide Columns Based on User Role”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-09/scaled-1680-/2022-09-16_16-06-08.png)

**Step 4**

**Add the following code to the JavaScript tab of your page.**

```
TB.render('component_10', function(data) {
    if (!"{loggedInUser.Role}".contains("Default Role")) {
        $('.role-hide').hide();
    }
});
```

> **Note:** Remember to change the component ID and the user role matching your app.

![Screenshot for “Hide Columns Based on User Role”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-09/scaled-1680-/image-1663358931011.png)

**Original Community Post:**

[Hide Columns Based on User Role - Community Discussions / Tips and Tricks - Tadabase Community](https://community.tadabase.io/t/hide-columns-based-on-user-role/1644)
