---
title: Hide or control access to customized components
slug: cms-11/dev-docs/hiding-or-controlling-access-to-a-component
docTags: 
createdAt: 2026-07-22T19:45:16.749Z
---

The `AllowedRoles` property for component definitions lets you control the groups that are allowed to view and select a certain component. You can hide a component completely by setting the `AllowedRoles` property to none, or setting it to a null string prevents an access check.

The following example shows how to hide or show a certain component, depending on a global setting.

```csharp
[Component]
public class FileManagementComponent: ComponentDefinitionBase {
  public FileManagementComponent(): base("epi-cms.component.FileManagement") {
    Categories = new string[] {
      "cms"
    };
    LanguagePath = "/episerver/cms/components/filemanagement";
    SortOrder = 200;
    PlugInAreas = new string[] {
      PlugInArea.DefaultAssetsGroup
    };

    AllowedRoles.Clear();
    AllowedRoles.Add("none");
  }
}
```
