Action Visibility
Controlling the visibility of actions in Umbraco UI Builder, the backoffice UI builder for Umbraco.
By default actions are not visible in the UI and you must expressly define when and where an action should display. This can be achieved in two ways, either on the action definition itself or at the point of registration on the collections config.
Controlling the default action visibility
To define the default visibility of an action at the action level you can do this by overriding the IsVisible
method of the Action<>
base class.
The IsVisible
method is passed a ActionVisibilityContext
which you should use to decide whether the action should display, returning true
if it should, or false
if it should not. For more information check the Action visibility context.
Overriding an actions visibility
Overriding an actions visibility is controlled via the collections configuration.
AddAction<TMenuActionType>(Lambda actionConfig = null) : CollectionConfigBuilder<TEntityType>
Adds an action of the given type to the collection with the given visibility.
AddAction(Type actionType, Lambda actionConfig = null) : CollectionConfigBuilder<TEntityType>
Adds an action of the given type to the collection with the given visibility.
AddAction(IAction action, Lambda actionConfig = null) : CollectionConfigBuilder<TEntityType>
Adds the given action to the collection with the given visibility.
Action visibility context
When controlling the visibility of an action you will be given a ActionVisibilityContext
object from which you can decide whether to show the action or not. The visibility context contains two key pieces of information on which you can base this decision.
ActionType
The action type property is an enum property that define which area of the UI it is that wishes to access this action. Enabling an action to display for a given action type will determine where an action is displayed.
ContainerMenu
The ContainerMenu
action type determines that the action will be displayed in both the tree of the collection and its list view actions menu.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F2059272600-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fj6FmBruCSGbXJIJB2aRu%252Fuploads%252Fgit-blob-1e6871db48d6d622aacc1d47f0852d3e4205228e%252Fcontainer_actions_menu.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=c8b44e1b&sv=1)
EntityMenu
The EntityMenu
action type determines that the action will be displayed in the actions menu of a collection editor UI.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F2059272600-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fj6FmBruCSGbXJIJB2aRu%252Fuploads%252Fgit-blob-2757026dd17a2142dcb452bc18ff1d7bf6766038%252Fentity_actions_menu.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=7929cda9&sv=1)
Bulk
The Bulk
action type determines that the action will be displayed in the collection list view bulk actions menu.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F2059272600-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fj6FmBruCSGbXJIJB2aRu%252Fuploads%252Fgit-blob-877720ad906365db6432588c2a6db265148aafdc%252Fbulk_actions_menu.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=3e88f879&sv=1)
Row
The Row
action type determines that the action will be displayed in the collection list view action row menu.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F2059272600-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fj6FmBruCSGbXJIJB2aRu%252Fuploads%252Fgit-blob-9874172a29eacecd9bb1c06c74e8296ded8cdc30%252Frow_actions_menu.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=cc397151&sv=1)
Save
The Save
action type determines that the action will be displayed as a sub button in an entity editors save button. All Save
action types trigger a save before the action is executed and so to convey this, all Save
action type button labels are prefixed Save & [Action Name]
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F2059272600-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fj6FmBruCSGbXJIJB2aRu%252Fuploads%252Fgit-blob-cf818ba674ae8bb2a9b2d772911ec29721b4b529%252Fsave_actions_menu.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=1ac26538&sv=1)
UserGroups
The user groups collection contains a list of Umbraco IReadOnlyUserGroup
objects for the current logged-in backoffice user. This allows you to control the visibility of actions for given user group members.
Last updated