ClickorKeyboard shortcut Alt + L

Dragto resize

Nord Design System SearchDeveloperDeveloperGetting startedUsing Web ComponentsWebfontsCDNLocalizationCSS Framework Legacy ESLint PluginWorking with AIFAQDesignDesignGetting startedFoundationsThemesBrand assetsToolsComponentsComponentsAccordion New Aside New Autocomplete New AvatarBadgeBanner Updated ButtonButton GroupCalendar Updated CardCheckbox Updated Collapsible New Combobox New Command MenuDate Picker Updated Date Range Picker New DividerDrawerDropdownEmpty StateField New FieldsetFilter Bar New FooterHeaderIconInput Updated Item New Kbd New LayoutMessageMeter New ModalNavigationNotificationNumber Field New Otp Field New Outline New Pagination New Popout Updated ProgressProgress BarQrcodeRadio Updated Range Updated Scroll Area New Segmented ControlSelect Updated SkeletonSpinnerStackTabTableTagTextarea Updated Time Picker New ToastToggle Updated TooltipTop BarTruncate New Visually HiddenDesign TokensDesign TokensTailwind CSSTailwind CSSBlocksBlocksTemplatesTemplatesIconsIconsPlaygroundPlaygroundLatest UpdatesLatest UpdatesChangelogChangelogMigration guidesMigration guides
GitHub

Clickto expandKeyboard shortcut Alt + L

Message

Open in Storybook

Represent a specific item within a collection, such as notifications, tasks or conversations.

Loading...

Usage

Message represents a specific item within a collection, such as notifications, tasks or conversations. Use the default slot for the content and the footer slot for supporting detail like a timestamp. A message can be placed directly inside a dropdown.

import "@nordhealth/components/lib/Message"

Examples

Basic

A standalone message with a heading and body, the simplest building block.

Unread and read

Mark a message as unread to show an indicator. By default messages are read.

Highlight

Add highlight to visually emphasise a message that has just appeared. Remove the highlight after the user has had a chance to see it, for example after a 30 second timeout.

Set href to render the message as a link.

RTL

Messages follow the document or container direction. Toggle the direction to see the layout mirror.

Accessibility

  • A message renders as a link when href is set and a button otherwise, so it is focusable and operable with the keyboard.
  • The unread indicator exposes an accessible label, so screen reader users are told a message is unread rather than relying on the visual dot alone.
  • Use the footer slot for supporting detail such as a timestamp so the main content stays the primary, clearly announced text.

API reference

Message

Message represents a specific item within a collection, such as notifications, tasks or conversations. Message can be placed directly inside a dropdown component.

<nord-accordion></nord-accordion>

Props

PropertyAttribute Description TypeDefault
hrefhrefThe url the message should link to.string | undefined
highlighthighlightHighlight the message visually. This is meant for highlighting a new message that just appeared. Highlight style should be removed after the user has seen the message and there’s been a timeout of e.g. 30 seconds.boolean | undefined
unreadunreadMark the message as unread. By default messages are read.boolean | undefined

Slots

Slot name Description
Default slotThe message content.
footerUsed to place content after the message. Typically used for a timestamp.

Methods

Method nameParameters Description
focus(options?: FocusOptions) => voidoptions: An object which controls aspects of the focusing process.Programmatically move focus to the component.
blur() => voidN/AProgrammatically remove focus from the component.
click() => voidN/AProgrammatically simulates a click on the component.

CSS Properties

CSS Custom Properties provide more fine grain control over component presentation. We advise utilizing existing properties on the component before using these.

PropertyDescriptionDefault
--n-message-border-colorControls the border color of the message, using our color tokens.var(--n-color-border)

Dependencies

This component is internally dependent on the following components:

Design guidelinesFor designers

Usage

This section includes guidelines for designers and developers about the usage of this component in different contexts.

Do

  • Messages should always perform an action when clicked.
  • The click action should navigate to a new page or provide more detail about the message.
  • Mark unread messages as read on user interaction.

Don’t

  • Don’t slot other components inside a message.

Content guidelines

Message content should be clear, accurate and easy to understand:

Ariel Salminen arrived to clinic with Pixie cat.
Patient arrived

When writing the message content, be concise. Keep content to 1 to 2 sentence:

You’ve reached the limit of 30 users included in your plan. Upgrade to add more.
You have reached the user limit. Your clinic can only have a maximum of 30 users. To add more users, remove users you no longer need or upgrade your plan to add more.

When writing the notification content, always write it in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):

Ariel Salminen arrived to clinic with Pixie cat.
Ariel Salminen Arrived To Clinic With Pixie Cat.

Always end in punctuation:

Ariel Salminen arrived to clinic with Pixie cat.
Ariel Salminen arrived to clinic with Pixie cat

Avoid all caps for messages:

Nina Williams arrived to clinic with Norfryd
NINA WILLIAMS ARRIVED TO CLINIC WITH NORFRYD