Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

Tones

Pick the tone by what the message means: info for notices, success for updates, danger for serious problems.

The five tones
A new version of the app is available. Refresh to update.
Your export finished. Download it from Reports.
Your trial ends in 3 days. Upgrade to keep full access.
Payments are temporarily unavailable. We're on it.
This workspace is read-only during the audit.
Show code
<app-banner tone="Info">A new version of the app is available. Refresh to update.</app-banner>
<app-banner tone="Success">Your export finished. Download it from Reports.</app-banner>
<app-banner tone="Warning">Your trial ends in 3 days. Upgrade to keep full access.</app-banner>
<app-banner tone="Danger">Payments are temporarily unavailable. We're on it.</app-banner>
<app-banner tone="Neutral">This workspace is read-only during the audit.</app-banner>

A leading icon

Add an icon to reinforce the message at a glance, using a library icon name.

With a leading icon
Scheduled maintenance begins at 11:00 PM IST tonight.
Show code
<app-banner tone="Warning" icon="alert-triangle">
  Scheduled maintenance begins at 11:00 PM IST tonight.
</app-banner>

With an action

Put a link or a button in the banner so the reader can act on it straight away.

An inline action link
A new version of the app is ready. Refresh now
Show code
<app-banner tone="Info" icon="zap">
  A new version of the app is ready. <a href="/refresh">Refresh now</a>
</app-banner>
A banner with an action button
A new version is ready.
Show code
<app-banner tone="Info" icon="refresh-cw">
  A new version is ready.
  <app-banner-action><app-button size="WideSize.Sm" variant="Soft">Reload</app-button></app-banner-action>
</app-banner>

Dismissible

Let the reader clear a notice they have seen, but not a condition that should keep showing.

A dismissible banner
We rolled out a few improvements to reports. Nothing you need to do.
Show code
<app-banner tone="Info" dismissible="true">
  We rolled out a few improvements to reports. Nothing you need to do.
</app-banner>

Every option

Every value of every prop, one cell each.

content

plain message
A new version of the app is available.
message with an inline action link
A new version of the app is ready. Refresh now
long content wraps within the banner
This is a deliberately long announcement to show how the banner wraps its message across multiple lines instead of overflowing the page or truncating the text. The body grows to fit whatever content it's given.

tone: all five

tone="info" (default)
Message in the info tone
tone="success"
Message in the success tone
tone="warning"
Message in the warning tone
tone="danger"
Message in the danger tone
tone="neutral"
Message in the neutral tone

icon

icon omitted (default): no icon
No leading icon
icon="alert-triangle": glyph name
Named icon
icon={<svg/>}: React only, Razor takes a glyph name
Razor reads the icon as a glyph name

dismissible

dismissible omitted (default): no close button
Not dismissible
dismissible="true": shows a × the user can click
Click the × to dismiss
dismissible="true" with icon and tone combined
Payments are temporarily unavailable. We're on it.

action

app-banner-action omitted (default)
Without an action
app-banner-action: a button at the right edge
A new version is ready.

onClose

onClose: React only, Razor has no callback
Dismissing removes the banner without a callback

className

className: React only, Razor has no className prop
Razor sets no extra classes on the banner

dismissLabel

dismiss-label="Dismiss" (default)
Close button is named Dismiss
dismiss-label="Fermer": replaces the English text
Close button is named Fermer

Guidance

What to do, and what to avoid.

Use it when

  • The message applies to the whole screen or app, not one section of it.
  • It should stay visible until the user dismisses it or the condition it reports ends.
  • It is the kind of thing every user of the page needs to see: maintenance, a trial ending, a new version.

Reach for something else when

  • The message is about one section or form on the page. → AppAlert
  • The feedback is brief and self-dismissing, such as Saved or Copied. → toast
  • You are explaining how something works, not reporting a state. → AppAlert

Banner only for page-wide notices

Do
Scheduled maintenance begins at 11:00 PM IST tonight.

A page-wide, time-bound notice every visitor needs to see, with a tone that matches its urgency.

Avoid
Enter a valid email address in the field below.

A field-level validation message belongs next to the field, not full-bleed across the page. That is AppAlert's job.

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

info success warning danger neutral
(none) alert-triangle zap notification
Scheduled maintenance tonight
React, generated from the controls
<AppBanner onClose={fn}>Scheduled maintenance tonight</AppBanner>
Razor, the same props
<app-banner>Scheduled maintenance tonight</app-banner>

6 props. The 4 most used come first.

Used on most screens 4 props

PropTypeDefaultDescription
tonedefault info info | success | warning | danger | neutral info The colour and intent of the banner.
icondefault - string - A leading icon: a library icon name or any node.
dismissibledefault false bool false Shows a close button that removes the banner.
dismiss-labeldefault Dismiss string Dismiss Replaces the built-in English text, for other languages.

Less common 2 props

PropTypeDefaultDescription
(content)default - markup - The banner message; may include an inline action link.
onClosedefault - - - Razor has no server-side dismiss callback (the dismiss button is a client-side DOM removal).

Screen reader

2 notes
  • The banner has role status, so a screen reader announces it politely when it appears.
  • The close button, shown with dismissible, is named Dismiss.

Do and avoid

1 pairs

Banner only for page-wide notices

Do
Scheduled maintenance begins at 11:00 PM IST tonight.

A page-wide, time-bound notice every visitor needs to see, with a tone that matches its urgency.

Avoid
Enter a valid email address in the field below.

A field-level validation message belongs next to the field, not full-bleed across the page. That is AppAlert's job.