Skip to content
Okaapiأوكابي
Framework for the code
Theme
Okaapi on GitHub

Chapter 10 Feedback

Alert

A message in the page, such as a problem with the whole form or a notice about the account. The title says what it is in words; the icon's shape and the colour repeat it. For a note after an action, use a toast; for a question that needs an answer, an alert dialog.

Use it in Angular
import { AlertComponent } from '@okaapi-ui/angular';
// Not announced on page load. Shown after an action? Add role="alert" or role="status".

Tones

Body text passes 7:1 on every tone, in both themes.

New: export to PDF

Reports can now be saved as PDF from the menu.

Payment received

Invoice 1042 is paid.

Your plan ends on 1 December

Renew it to keep your reports.

The form has 2 problems

Fix the fields marked below, then send it again.
Angular
<ui-alert title="New: export to PDF">Reports can now be saved as PDF from the menu.</ui-alert>
<ui-alert tone="success" title="Payment received">Invoice 1042 is paid.</ui-alert>
<ui-alert tone="warning" title="Your plan ends on 1 December">Renew it to keep your reports.</ui-alert>
<ui-alert tone="danger" title="The form has 2 problems">Fix the fields marked below.</ui-alert>

With actions, and closable

Close removes it from the page; the button's name says what it does.

Your plan ends on 1 December

Renew it to keep your reports.
Angular
<ui-alert
  tone="warning"
  title="Your plan ends on 1 December"
  [dismissible]="true"
  closeLabel="Dismiss"
  (dismiss)="shown.set(false)"
>
  Renew it to keep your reports.
  <div ui-alert-actions>
    <button ui-button size="sm">Renew</button>
    <button ui-button size="sm" variant="secondary">See plans</button>
  </div>
</ui-alert>

In Arabic

الدفع وصل

الفاتورة ١٠٤٢ اتدفعت.
Angular
<ui-alert tone="success" title="الدفع وصل" closeLabel="إخفاء">الفاتورة ١٠٤٢ اتدفعت.</ui-alert>

When to use something else

If you needUse
Confirm an action that just finishedToast
Stop the reader until they decideAlert dialog
Show a status in a row or a cardBadge

Inputs

NameTypeDefaultWhat it does
tone'info' | 'success' | 'warning' | 'danger''info'Icon and colour. The title must say it too.
titlestring — A few words in bold that say what it is.
dismissiblebooleanfalseShows a close button.
closeLabelstring'Dismiss' from labelsIts accessible name, translated.
(dismiss)void — The close button was pressed: remove the alert.
[ui-alert-actions]slot — An element holding buttons, under the message.

Keyboard and screen readers

  • The title says what it is in words; the icon and the colour only repeat it.