Blazor playground

Nova v3.37.0

Preview

Blazor

Environment indicator

nv-environmentindicator

A coloured strip and tab that show an application isn't running in production, with its build information one click away.

Live demo

Env
Mode

Overview

Use the environment indicator to make it obvious that an application is running in development, test or acceptance, so people don't mistake it for production. It only marks the environment; it doesn't change or protect the deployment. In production, or with no or an unknown env, it renders nothing.

Anatomy

A DEV environment indicator with its build information visible. Callouts 1, 2 and 3 mark the coloured strip, the DEV tab and the tooltip containing the environment name, version, build, commit and deployment time.

The parts of an environment indicator in the focused state.
  1. Strip: a thin line across the top. DEV, TEST and ACC each have their own reserved colour.
  2. Tab: the environment label, such as "TEST", hanging from the strip. A custom label (up to 6 characters, such as "TEST-2") replaces it; the colour still comes from env.
  3. Tooltip: on hover or focus, the environment name and any version, build, commit and deployedAt. Clicking the tab copies them and emits environmentCopied.

Properties

Design settingCodeMapping
EnvironmentenvDEV, TEST, ACC; other environments render nothing.
Modemodeauto follows window focus; focused and unfocused force a mode.
StateInteractionDefault, hover, keyboard focus and copied feedback.
EnableddisabledSet to true to suppress the indicator.
Label visiblepersistent, hideDelayThe tab normally hides after 5000 ms.
Custom labellabelUppercase, limited to six characters; colour still follows env.
Build informationtooltip, version, build, commit, deployedAtVersion, build and commit form the build line; deployment time can appear on its own.
Deploy-time configurationautoDetectReads unset values from window.__NOVA_ENVIRONMENT__ or nova-* meta tags.
Page titleprefixTitleAdds the environment prefix to the document title.
Preview containmentcontainedAnchors inside a positioned parent without changing the page layout.
Copy confirmationenvironmentCopiedEmits the copied text after a successful copy.

Look and feel

Each environment has a reserved colour. The focused appearance is a 4 px strip with a hanging tab; the unfocused appearance frames the page. Both support Spark and Ocean in light and dark mode.

Hover and keyboard focus reveal the tooltip. A successful copy briefly replaces the tab label with “Copied”. A hidden tab returns when the pointer approaches it, on keyboard focus, or when the window regains focus.

Behavior

Only the strip takes space in the document. Content scrolls beneath it. When the window loses focus, the page scales into the coloured frame without reflowing. If a click restores focus, the frame remains until that click has landed, then the page returns to its normal scale.

Use the framework environment service to read application configuration: NovaEnvironmentProvider in React, NvEnvironmentService in Vue, provideNovaEnvironment in Angular, or AddNovaEnvironment in Blazor. Plain HTML can use autoDetect for deployment-time configuration. The examples show the framework-specific setup.

The live demo uses contained and a forced mode so the indicator stays inside the preview. Application roots normally use the default auto mode.

Accessibility

The environment label identifies the context independently of colour. Keyboard focus reveals both the tab and its tooltip, including when the tab has automatically hidden. The “Copied” state confirms the copy action.

Usage

  • Mount one indicator at the application root in non-production deployments.
  • Use a short custom label such as TEST-2 for parallel environments.
  • Keep deployment context separate from business status; the indicator does not render in production and does not protect a deployment.
  • Avoid adding a second environment banner for the same application.

Related

Use a status indicator to describe a system or process within the page.

Sources