Skip to content
MyAppBuilder
StableGuide

Hide and show per device

There are three different ways to make a component disappear in MyAppBuilder, and they answer three different questions:

There are three different ways to make a component disappear in MyAppBuilder, and they answer three different questions:

QuestionFeatureWhere
Should this appear on this screen size?Visibility per breakpointInspector › Visibility (checkboxes) or Responsive › "Hide on …"
Should this appear in this situation? (a record's status, a state value, the signed-in user)Visibility rule ("Show only when")Inspector › Visibility
Is this user allowed to see it at all?Component permissionsInspector › Permissions

Only the last one is a security boundary. The first two are display rules.

Hide on one device

  1. Select the component.
  2. Open the Visibility tab. Under the device checkboxes, untick Mobile (or Tablet, or Desktop). Alternatively open the Responsive tab, pick the breakpoint and tick Hide on mobile.
  3. In the editor the component stays visible as a faded "ghost" so you can still select it; in preview and in the published app it is removed at that size.

Typical uses: a decorative hero image hidden on mobile, a wide chart hidden on phones with a KPI shown instead, or a compact mobile-only button.

Example
Desktop                              Mobile
[ Revenue chart (hidden on mobile) ] [ Revenue KPI (hidden on desktop) ]
[ Revenue KPI  (hidden on desktop) ]

Show only when (visibility rules)

The Show only when editor in the Visibility tab builds a condition from data the component can see: the current record, page parameters, app or page state, the current user. Examples:

  • Show the "Mark as paid" button only when the invoice Status is not Paid.
  • Show the "Welcome back" text only when user.isAuthenticated is true.

The help text under the editor is explicit: "A display rule — not a security boundary. Use Permissions to protect content." A hidden button is still a button that exists in the page definition.

Permissions (who may see it)

In the Permissions tab, "Everyone who can open the page" is ticked by default. Untick it and pick roles to restrict the component. Components a role may not see are removed on the server before the page is sent to that user, so they cannot be revealed by resizing the window or editing the page in the browser. Page-level access (sign-in required, allowed roles) works the same way.

Which one should I use?

  • Different layout per device → Hide on breakpoint.
  • Depends on data or state → Show only when.
  • Depends on the user's role, or protects data or actions → Permissions (plus entity permissions in Users).

Common mistakes

  • Hiding an admin button with a visibility rule on user.role. Use Permissions instead; the server will also refuse the action if the role lacks entity permissions.
  • Hiding the only navigation on mobile. Visitors have no way to move around. Use the Navigation Menu's bottom bar variant instead of hiding the menu.
  • Forgetting the ghost. A faded component on the canvas is hidden at the current breakpoint, not broken. Check the Visibility tab.

Advanced

Per-breakpoint hiding is stored as responsive.<breakpoint>.hidden and rendered with the classes mab-hide-d, mab-hide-t, mab-hide-m (CSS display: none under container queries). Visibility rules are stored in component.visibility as a condition evaluated client-side by useVisible(). Permissions are stored in component.permissions.roles and enforced by configForUser() on the server, which also strips the component from the configuration delivered to the browser.

Related

Was this helpful?