Anchor Design System

Notification Inline3.0

The notification-inline component is a simple alert component that can display a variety of different types of messages, including error, info, success, and warning messages. It also displays an icon corresponding to the type of message being displayed.

Installation

npm i @tryg/vue-ui-library

Usage

Install the component library as a Vue plugin. This globally registers all Anchor components.

main.js
import { createApp } from 'vue';
import { ComponentLibrary } from '@tryg/vue-ui-library';
import App from './App.vue';

const app = createApp(App);
app.use(ComponentLibrary);
app.mount('#app');
YourComponent.vue
<template>
  <anchor-notification-inline>
    This is an error message.
  </anchor-notification-inline>
</template>

Import only the components you need for optimal bundle size.

YourComponent.vue
<script setup>
import { AnchorNotificationInline } from '@tryg/vue-ui-library';
</script>
<template>
  <anchor-notification-inline>
    This is an error message.
  </anchor-notification-inline>
</template>

Error notification

Header slot

You can give the notification a bold header by using the header slot.

You can give the notification a link by using the link slot. Remember that you have to use an <a> tag in the slot. And you have to use the slot="link" attribute on the <a> tag.

Example:

Accessibility

  • Uses role="alert" for error and warning types, and role="status" for info and success types, so screen readers announce them appropriately.
  • The type prop determines the ARIA role, allowing assistive technology to convey the correct level of urgency.
  • Icon visually conveys severity (alert-triangle for error, info for info, check-circle for success, alert-circle for warning).
  • Supports aria-live regions for dynamically inserted notifications, ensuring screen reader users are notified of new content.
  • For dynamically added notifications, consider using aria-live="assertive" on error messages to interrupt the user's current task.

CSS variables

The following CSS custom properties are exposed:

VariableDescription
--background-colorDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--border-colorDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--border-radiusDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--border-widthDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--gapDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--inline-icon-colorDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--lineheightDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--notification-inline-background-colorSet the background color of the <anchor-notification-inline>
--notification-inline-border-colorSet the border color of the <anchor-notification-inline>
--notification-inline-border-radiusSet the border radius of the <anchor-notification-inline>
--notification-inline-border-widthSet the border width of the <anchor-notification-inline>
--notification-inline-gapSet the gap width of the <anchor-notification-inline>
--notification-inline-icon-colorSet the color of the inline icon in the <anchor-notification-inline>
--notification-inline-lineheightSet the lineheight of the <anchor-notification-inline>
--notification-inline-link-colorSet the color of the links in the <anchor-notification-inline>
--notification-inline-text-colorSet the text color of the <anchor-notification-inline>
--notification-inline-widthSet the width of the <anchor-notification-inline>
--text-colorDEPRECATED: kept for backwards compatibility, but will be removed by April 2024

API

Inline notification

Properties

PropertyAttributeDescriptionTypeDefault
typetypeThe type of alert to display. Can be 'error', 'info', 'success', or 'warning'."error" | "info" | "success" | "warning"undefined
uuiduuidGive this instance of notification-inline a custom ID, or keep the default.stringuuidv4()

CSS Custom Properties

NameDescription
--background-colorDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--border-colorDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--border-radiusDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--border-widthDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--gapDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--inline-icon-colorDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--lineheightDEPRECATED: kept for backwards compatibility, but will be removed by April 2024
--notification-inline-background-colorSet the background color of the
--notification-inline-border-colorSet the border color of the
--notification-inline-border-radiusSet the border radius of the
--notification-inline-border-widthSet the border width of the
--notification-inline-gapSet the gap width of the
--notification-inline-icon-colorSet the color of the inline icon in the
--notification-inline-lineheightSet the lineheight of the
--notification-inline-link-colorSet the color of the links in the
--notification-inline-text-colorSet the text color of the
--notification-inline-widthSet the width of the
--text-colorDEPRECATED: kept for backwards compatibility, but will be removed by April 2024

Dependencies

Depends on

Graph

graph TD;
  anchor-notification-inline --> anchor-icon
  style anchor-notification-inline fill:#f9f,stroke:#333,stroke-width:4px

Built with StencilJS

On this page