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
    Commented Jul 3, 2018 at 14:36

5 Answers 5


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.


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.


I'm fairly new to this, too. As of Winter 21, it seems you might have to create an Audience...

At least, if you are trying to expose your LWC selectively within Digital Experiences (fka Communities) - within a 'Builder' page designer...

  1. Select the component (or drag it onto the layout if not there)
  2. Click the little upper-right chevron, see the Audience section, select Assign
    assign LWC to an audience
  3. It will give an option to create an audience if you haven't any.. looks like this:
    enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .