[data-reveal]{opacity:1!important;transform:none!important}
AntelopeJS DMS
DocumentationLayout banners

Layout banners

A layout banner is a global message the backend adds under the dashboard header: a colored strip with a line of text and its link buttons, or a component of your frontend layer.

A layout banner is a global message that the backend adds under the dashboard header. It is a colored strip with a line of text and its link buttons, or a component of your frontend layer. A banner renders on the pages its scope selects. By default those are the application's pages, without the module area under /modules. Banners stack by order.

The server decides per request whether a banner shows, while it builds the site layout. The answer is part of the server-rendered page, so a banner never flashes in or out after hydration.

Everything on this page lives in @antelopejs/interface-dms/layout-banners.

Register a banner

RegisterLayoutBanner(info) registers the banner and returns a function that removes it. Register at import time, next to the state the banner reports on. The DMS drops the registration when your module stops.

typescript
import {
  LayoutBannerVariant,
  RegisterLayoutBanner,
} from "@antelopejs/interface-dms/layout-banners";
import { isMaintenanceScheduled } from "./maintenance";

RegisterLayoutBanner({
  key: "my-app:maintenance",
  variant: LayoutBannerVariant.WARNING,
  text: "$my_app.banners.maintenance",
  order: 10,
  dismissible: true,
  visible: async ({ tenantId }) => isMaintenanceScheduled(tenantId),
});

The text can be a composed text. A composed text is an i18n key and the raw values it names, written in the reader's language. actions adds link buttons after the text, and the last button is the main action:

typescript
import { LayoutBannerVariant, RegisterLayoutBanner } from "@antelopejs/interface-dms/layout-banners";

RegisterLayoutBanner({
  key: "my-app:maintenance",
  variant: LayoutBannerVariant.WARNING,
  text: {
    key: "my_app.banners.maintenance_at", // "Maintenance {date}"
    params: { date: { type: "datetime", value: "2026-10-12T22:00:00Z" } },
  },
  actions: [{ label: "$my_app.banners.status", to: "https://status.example.com" }],
});

A banner with no text, no component and no resolve is skipped, and the server logs a warning once for it.

Resolve the content per request

Some messages name the state that makes the banner show, such as the invoice that failed, its amount, or the day the workspace is suspended. For those, resolve(context) builds the text and the buttons for each request, or answers undefined to hide the banner. It replaces visible, so one read decides both.

typescript
RegisterLayoutBanner({
  key: "saas:past-due",
  variant: LayoutBannerVariant.ERROR,
  resolve: async ({ tenantId }) => {
    const invoice = await openInvoice(tenantId);
    if (!invoice) return undefined;
    return {
      text: {
        key: "saas.banner.past_due", // "Invoice {invoice} of {amount} failed, retry {date}"
        params: {
          invoice: invoice.number,
          amount: { type: "money", value: invoice.amountDue, currency: invoice.currency },
          date: { type: "date", value: invoice.nextAttemptAt, format: "day" },
        },
      },
      actions: [{ label: "$saas.banner.pay", to: "/settings/workspace/billing?pay=1" }],
    };
  },
});

The server sends the raw values, and the browser formats them for the reader's language, time zone and clock. The resolver never formats text. A banner like this one needs no frontend component.

Mount a component

A banner can mount a global component of your frontend layer in place of a text. The DMS still draws the chrome around it (the color, the icon, the close button and the ARIA role) and passes props to the component:

typescript
import { LayoutBannerVariant, RegisterLayoutBanner } from "@antelopejs/interface-dms/layout-banners";

RegisterLayoutBanner({
  key: "my-app:trial",
  variant: LayoutBannerVariant.INFO,
  component: "MyAppTrialBanner",
  props: { upgradeUrl: "/settings/billing" },
  visible: ({ isOwner }) => isOwner,
});

A second registration with the same key replaces the banner.

Scope

By default, a banner shows on the application's pages only and stays out of the module area. A banner about the application being built, such as eighteen overdue invoices or a stock alert, has no place there. The module area is every page under MODULE_URL_PREFIX (/modules): the modules page, the module store and the back-office pages of each module. A banner about the workspace itself must follow the user into a module. Billing past due, a suspended workspace and a maintenance window are examples. Such a banner sets scope: LayoutBannerScope.EVERYWHERE.

scope is a plain option of the banner declaration. It is the same on the three kinds of banner (a text banner, a resolved banner and a component banner), with the same values and the same "app" default:

typescript
import {
  LayoutBannerScope,
  LayoutBannerVariant,
  RegisterLayoutBanner,
} from "@antelopejs/interface-dms/layout-banners";

// A text banner about the application: the default scope, written out.
RegisterLayoutBanner({
  key: "my-app:overdue-invoices",
  variant: LayoutBannerVariant.WARNING,
  scope: LayoutBannerScope.APP,
  text: "$my_app.banners.overdue_invoices",
  actions: [{ label: "$my_app.banners.review", to: "/finance/invoices" }],
  visible: async ({ tenantId }) => hasOverdueInvoices(tenantId),
});

// A resolved banner about the workspace: it follows the user into /modules.
RegisterLayoutBanner({
  key: "saas:past-due",
  variant: LayoutBannerVariant.ERROR,
  scope: LayoutBannerScope.EVERYWHERE,
  resolve: pastDueContent,
});

// A component banner about the workspace, also shown inside /modules.
RegisterLayoutBanner({
  key: "my-app:maintenance",
  variant: LayoutBannerVariant.INFO,
  scope: LayoutBannerScope.EVERYWHERE,
  component: "MyAppMaintenanceBanner",
  props: { statusUrl: "https://status.example.com" },
  visible: async () => isMaintenanceScheduled(),
});
scopeShows on
"app" (default)Every page outside the module area.
"everywhere"Every page of the dashboard layout, module area included.
"modules"The module area only.

The page decides the scope, not the request. The client fetches the site layout once and every page shares it, so each banner carries its scope, and the dashboard applies the scope against the current route. The dashboard applies it in the server-rendered page, so a banner never flashes in or out after hydration. It applies it again on each client-side navigation, so moving in or out of /modules adds or removes the banner without a new fetch. A banner's visible or resolve does not see the route, and the scope is the only filter per page. The server falls back to "app" for a scope value outside the three listed.

A dismissal applies to the key, whatever page the user closed the banner on.

Warning

A banner registered without scope stays out of /modules. Give scope: LayoutBannerScope.EVERYWHERE to the banners that report a state of the whole workspace.

LayoutBannerInfo

FieldTypeDescription
keystringRequired. Unique across the deployment. A dismissal also remembers the key, so give a banner a new key when it must show again to users who dismissed it.
variantLayoutBannerVariantRequired. "info", "warning" or "error". Picks the color, the default icon and the ARIA role.
textstring | ComposedTextThe message. A value with the $ prefix resolves as an i18n key. A ComposedText is written in the reader's language. Exclusive with component and resolve, and one of the three is required.
actionsBlockLinkAction[]Link buttons after text. The last one is the main action. Labels follow the $ convention.
componentstringThe name of a global component rendered as the banner's content. Exclusive with text and resolve.
props{ readonly [prop: string]: JsonValue }Props passed to component, as JSON.
ordernumberStack order, ascending from the top. Defaults to 0. Ties keep the registration order.
iconstringLeading icon. Defaults to one that matches the variant.
dismissiblebooleanWhether the user can close the banner. Defaults to false.
scopeLayoutBannerScope"app", "everywhere" or "modules", the pages the banner shows on. Defaults to "app", every page outside /modules. See Scope.
visibleLayoutBannerVisibilityDecides per request whether a text or component banner shows. Without it, the banner always shows.
resolveLayoutBannerResolverBuilds { text, actions? } per request, or answers undefined to hide the banner. Exclusive with text, component and visible.

Visibility

visible(context) returns a boolean, or a promise of one. resolve(context) returns a LayoutBannerContent ({ text, actions? }), undefined, or a promise of either. The server runs them for every site layout request, all resolvers at once, so the request waits for the slowest one and not for their sum. A banner is hidden for that request in four cases:

  • Its resolver throws.
  • Its resolver does not answer within two seconds.
  • Its visible returns anything other than true.
  • Its resolve answers no text.

The other banners are unaffected.

LayoutBannerContext

FieldTypeDescription
userUser | undefinedThe caller. undefined for an unauthenticated request.
tenantIdstringThe tenant the site layout is built for.
permissionsSet<string>The caller's effective permissions in the tenant, with no tenant access gate applied.
isOwnerbooleanWhether the caller holds the wildcard permission, with no tenant access gate applied.
isTenantAccessDeniedbooleanWhether a tenant access gate refuses the caller.

The other product surfaces lose the permissions that a denying access gate hides, but a banner still reads them. A banner is how a suspended or past-due workspace learns why. Check isTenantAccessDenied when the two situations call for different banners.

The resolvers run each time a client fetches its site layout, which happens on a full page load and after a menu invalidation. When the state a resolver reads changes, call NotifyMenuChanged(tenantId) from @antelopejs/interface-dms/page. The connected clients of that tenant then fetch the site layout again, and the banner appears or goes away without a reload.

Rendering

Banners render under the header of the dashboard layout, on the pages their scope covers, at full width, in order. The actions of a text banner sit on its right. Each banner is its own live region. An error banner carries role="alert", and an info or warning banner carries role="status".

A dismissible banner shows a close button. The dismissal lasts for the browser session and is stored in the dms-dismissed-banners cookie. The server reads that cookie too, so a dismissed banner is already absent from the server-rendered page. A banner that is not dismissible ignores any dismissal recorded under its key.