---
sourceDocument: Australia Build or modify applications
sourceDocumentLink: https://www.servicenow.com/docs/r/australia/application-development

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia Build or modify applications

ft:clusterId :

    - cadev

bundleId :

    - cadev

workflow :

    - Development, Data, and Analytics


---

# Lux Page variants

# Lux Page variants {#ariaid-title1}

Release version: Australia  
Updated September 29, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 6 minutes to read
Summarize  
![AI sparkle icon](https://servicenow.com/docs/portal-asset/ai-sparkle-icon) Summarized using AI  
This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.  

## Summary of Lux Page variants

Lux Page variants enable ServiceNow customers to serve structurally different pages under the same route, tailored per user or request, without branching render logic manually.
This feature is ideal when distinct layouts, widgets, or loaders are needed for different audiences rather than simply hiding sections conditionally.
Show full answer Show less  
A page collection groups multiple page modules claiming the same route. Variants reside in a `variants/` folder alongside an optional base page. Each variant can be gated by roles or ACLs and ordered to control which variant is served.

## Key Features

* **Page Collection Structure:** The base page sits at the normal route, with variants placed in a `variants/` sibling folder. Each variant can differ entirely in structure and content but shares the same route.
* **Gating and Ordering:** Variants use decorators to specify access controls and rank priority:
  * `@order(N)`: Controls variant priority, lower values serve first.
  * `@acl([...])`: Defines role-based or security attribute-based access rules.
  It is critical that ungated variants do not outrank gated ones to avoid unintended access.
* **Live Resolution:** The system dynamically selects which variant to serve per request based on the user's identity and access rights, ensuring the correct variant is always delivered, even mid-session.
* **Switching Between Variants:** Two UI components facilitate variant switching:
  * `<aiux-page-variant-switcher>`: For end-users/viewers to select accessible variants.
  * Config editor toolbar controls: For administrators configuring the page, allowing authoring-specific variant selection.
  Switching respects dirty-state guards and triggers full server-side route resolution rather than client-side swaps.
* **Configuration Records:** Each variant corresponds to a `sysaixpage` record with fields like `variantname`, `order`, and `active` to manage identity, precedence, and enablement status.

## Practical Implications for ServiceNow Customers

* Use Lux Page variants when you need fully different pages for different user roles or audiences under the same URL.
* The approach simplifies management by replacing complex render branching with declarative page variants.
* Access control is explicit and integrated, reducing risk of unintended page exposure.
* Administrators can disable variants without deletion via the `active` flag in the system record.
* Developers should carefully order variants and apply ACLs to ensure correct variant resolution.
* The system supports seamless variant switching during configuration and viewing, enhancing usability for admins and end-users alike.  
A page collection lets more than one page module claim the same route. Lux determines which one to serve, per request, per user, instead of you branching a single `render()` on role checks.

Use a page collection when a route needs a structurally different page for different audiences (different widgets, different layout, different loader), not just a conditionally hidden section. A hidden section is simpler to
express as a widget ACL or a reactive property.

Page variants make it a deliberate, authored pattern. A variant is one or more candidate pages in a _variants/ folder, plus an optional base page at the normal route. Each sibling is optionally gated by role
or access control list (ACL), and ranked by an explicit order.  
Note:  
There's no admin interface for reordering or disabling a page variant; order and active are edited directly on the installed `sys_aix_page` record.

## The _collections/ convention {#page-collections__page-collections-the-collections-convention}

Put a base page at the normal route, then add a _variants/ sibling folder next to it with one subfolder per candidate:

    pages/dashboard/
    ├── page.js                    ← base page, order 100 (default), no ACL
    └── _variants/
        └── admin/
            └── page.js            ← candidate, ranked ahead of the base page

_variants/ is reserved and contributes no route segment of its own. Every page.js/page.ts under it, at any nesting depth, resolves to the same route as the
sibling base page. A _variants/ folder that contains no page.js/page.ts fails the build. A base page next to it is optional; without one, the route comes from
the parent folder.

The older folder name, _collections/, still builds but logs a deprecation warning. A folder that contains both _variants/ and _collections/ fails the build.

## Declaring a candidate {#page-collections__page-collections-declaring-a-candidate}

Gate and rank a candidate with two build-time decorators from `@servicenow/aiux-components-core`:

    // pages/dashboard/_variants/admin/page.js
    import {html} from 'lit';
    import {customElement} from 'lit/decorators.js';
    import {AIUXElement, decorators} from '@servicenow/aiux-components-core';

    const {acl, order} = decorators;

    @customElement('collections-demo-dashboard-admin-page')
    @order(10)
    @acl([{decision: 'allow_if', roles: ['admin']}])
    export default class DashboardAdminPage extends AIUXElement {
      render() {
        return html`<h1>Dashboard (admin)</h1>`;
      }
    }

The decorators for gating and ranking a collection candidate are described in the following table.
{#page-collections__table-collection-candidate-decorators__entry__2}

| Decorator | Effect |
|-|-|
| `@order(N)` | Integer; lower wins. A page with no `@order()` gets the default, 100 (pages contributed by an extension default to 10). |
| `@acl([{decision?, roles?, securityAttribute?, id?}])` | `decision` is `'allow_if'` (the default) or `'deny_unless'`. Each rule needs a non-empty `roles` array of role names, a non-empty `securityAttribute` string, or both. `id` is optional. A rule set made only of `deny_unless` rules fails the build. The build emits one ACL record per rule. |
[Table 1. Variant candidate decorators]

{#page-collections__table-collection-candidate-decorators}  
Warning:  
An ungated candidate must not sort ahead of gated siblings, or it wins for everyone. A missing ACL record is read leniently, accessible to all, so an undecorated (or `@order()`-only) page with a lower order than its gated siblings permanently shadows them. Leave an intentional fallback page at the default order (100) or higher.

`@acl()` and a legacy `@roles()` decorator are mutually exclusive for a variant candidate. A page carrying both still gets its ACL record generated, but only the `roles` check runs
during resolution.

## How resolution works {#page-collections__page-collections-how-resolution-works}

1. Every `sys_aix_page` candidate whose `path_pattern` matches the requested path is collected.
2. Candidates are sorted by URL specificity first, then by `order` ascending; a base page and its _variants/ siblings share one route, so `order` alone decides among them.
3. Each candidate is checked, in that sorted order, by whichever access mechanism its own record declares. A legacy `roles` check fails closed on an infrastructure error. An ACL check runs against the candidate's own ACL records and fails open, so an undecorated page with no ACL record is accessible to everyone.
4. The first accessible candidate wins and is served, unless the request names an accessible sibling (the viewer's switcher choice or the URL), which is served instead. The rest are offered as alternatives, which is what the two pickers in the Switching between siblings section render from.

Variant candidates are resolved live, per request. A route with more than one page variant doesn't use the identity-blind on-disk fast path, so switching identity mid-session picks up the correct candidate on the next
request.

## Switching between siblings {#page-collections__page-collections-switching-between-siblings}

Two surfaces render the sibling pool, for two different audiences.
{#page-collections__table-sibling-pickers__entry__3}

| Aspect | `<aiux-page-variant-switcher>` | The config editor's collection picker |
|-|-|-|
| Package | `@servicenow/aiux-components-nav` | `@servicenow/aiux-components-config-editor` |
| Audience | Viewer | Admin, while configuring |
| Mount | `horizontal-contextual-nav`, through `nav-layout` | The config editor's toolbar |
| Gate | `features.pageVariantSwitcher`, default `true`, and the `aiux.nav.page_variant_switcher.enabled` system property, default `true`; both must allow it | Only while editing |
[Table 2. Sibling pickers]

{#page-collections__table-sibling-pickers}

Switching page variants while configuring is an authoring action rather than a viewer action, so the editor gets its own control labeled "Editing:" followed by the page variant title. An app that wants only the authoring
control turns the shell control off per app:

    navLayoutContext.set({
      ...(navLayoutContext.get() ?? {}),
      features: {...(navLayoutContext.get()?.features ?? {}), pageVariantSwitcher: false}
    });
    await super.loader(ctx);

Warning:  
NavLayout.loader takes only `ctx`. A second options argument is silently dropped, so feature opt-outs must be written onto `navLayoutContext` before `super.loader` runs, as the preceding example shows.

Both pickers run the switch through the router's beforeNavigate pipeline rather than assigning `location.href`, so a dirty-state guard goes first and switching can't silently discard
unsaved work. Either way the sibling is chosen during server route resolution; a switch re-resolves the route server-side rather than swapping client state.

The config editor's entry point appears for config admins when the page has a configurable component or more than one page variant.

## Schema {#page-collections__page-collections-schema}

`sys_aix_page` carries three fields for this feature.
{#page-collections__table-collection-fields-on-sys-aix-page__entry__4}

| Column | Type | Default | Purpose |
|-|-|-|-|
| `variant_name` | string |   | Identifies a collection page relative to its base page. The build derives it from the folder segment(s) under _variants/\<name\>/ and writes it onto the record (e.g. _variants/admin/page.js → `admin`); no manual authoring step. |
| `order` | integer | `100` (`10` for extension pages) | Evaluation precedence when multiple candidates match the same route. Lower wins. |
| `active` | boolean | `true` | Lets an admin disable a page variant without deleting it. |
[Table 3. Variant fields on sys_aix_page]

{#page-collections__table-collection-fields-on-sys-aix-page}

There's no `parent_page_id` link back to the base page and no `variant_name`/`is_default` flag; a page variant is identified purely by sharing its base page's
`path_pattern`.

## How a page becomes sys_aix_page in general {#page-collections__page-collections-how-a-page-becomes-sys-aix-page-in-general}

Outside the variants feature specifically, every page under pages/ maps to a `sys_aix_page` record the same way.
{#page-collections__table-page-to-record-derivation__entry__3}

| Source | Field | Derivation |
|-|-|-|
| Folder path under pages/ | `path_pattern` | `[param]` converts to `:param`; the page.js/page.ts filename is not part of the route |
| `@title()` decorator | `title` | Decorator value on the default export class |
| `@global(false)` decorator | `private_experience` | Restricts the page to the app's own experience. Build error if aiux.json has no `basename` |
| `@roles([...])` decorator | `roles` | Legacy role gate, distinct from `@acl()` |
[Table 4. Page-to-record derivation]

{#page-collections__table-page-to-record-derivation}
**Related tasks**   

* [Create a page](https://www.servicenow.com/docs/Il1iHhhSWeeZJpVYzRg6wQ "Add a page to a Lux app. A page is a Lit web component that Lux registers as a route based on where you put its file.")  
**Related topics**   

* 

