I am pretty new to lightning so I wanted to know if there is a way to hide a lightning component based on certain conditions. I have a requirement where there are 4 components which need to be visible to users belonging to a particular profile and should not be accessible to others.


  • in what context, lightning experience, or lightning communities? – glls Jul 3 '18 at 14:36

You can conditionally show/hide components on the page by setting the component visibility. Select your component and in the properties panel you have the flexibility to show/hide based on a field in the record or user level attributes. See below for clarity:

enter image description here

enter image description here


You cannot give access to Lightning Bundle from profile.

But you can do is rerender based on the logged in user profile.

  • How, could you developp ? Thanks ! – Alexis MASSON Mar 4 '19 at 10:27

You have 2 options:

  1. Create a custom lightning record home page for each profile and assign each page to each profile.

  2. Display/hide specific component, according to a field criteria on the current record.

Both scenarios are described well in this trail:

Build a Custom Record Page for Lightning Experience

The first scenario - under the Roll Out Your Custom Record Page to Your Lightning Experience Users section.

The second scenario - under the Make Your Record Page Dynamic section


You may find that your User>Profile>Name is "System Administrator". Check in Setup>Profiles.

You can also use filter logic for more complex conditions.

Two filters. Show if either is true.


How to hide a component based on the profil ? Instead of 'Contains', is there a way to '!Contains', to 'Not Contains' ?

I was unable to find that way, so I cloned my page and assign depending on the profile -not that satisfying solution.

  • (may be I should have post a comment, it's not really a reply, but it goes on the same direction the first issue went) – Alexis MASSON Jan 14 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.