|
| 1 | +[← Back to Contents Overview](0_contents.md) |
| 2 | + |
| 3 | +# Messages and Notifications |
| 4 | + |
| 5 | +Juno provides two distinct mechanisms for communicating status, feedback, and |
| 6 | +information to users: Messages and Notifications. They serve different purposes |
| 7 | +and must not be used interchangeably. |
| 8 | + |
| 9 | +## Messages |
| 10 | + |
| 11 | +A Message is a static UI element used to display contextual information, |
| 12 | +warnings, or feedback directly within the page or view. Messages are part of |
| 13 | +the rendered layout — they appear where placed and remain visible until the |
| 14 | +view changes or the condition that caused them is resolved. |
| 15 | + |
| 16 | +Use a Message to: |
| 17 | + |
| 18 | +- Communicate the result or consequence of a user action inline |
| 19 | +- Surface a persistent warning or constraint relevant to the current view |
| 20 | +- Provide contextual guidance or information directly related to nearby content |
| 21 | + |
| 22 | +Messages use [Semantic Variants](semantic-variants.md) (`info`, `success`, |
| 23 | +`warning`, `error`, `danger`) to communicate intent. Always choose the variant |
| 24 | +that matches the nature of the message, not for visual effect. The default |
| 25 | +variant is `info`. |
| 26 | + |
| 27 | +### Title |
| 28 | + |
| 29 | +A Message may optionally include a title. Use one only when the message needs |
| 30 | +a clear heading to stand apart from surrounding content — for example, when |
| 31 | +the message is prominent or contains multiple sentences. Do not add a title by |
| 32 | +default. |
| 33 | + |
| 34 | +### Content |
| 35 | + |
| 36 | +Pass simple text via the `text` prop. For content that requires formatting or |
| 37 | +includes links, pass it as children instead. |
| 38 | + |
| 39 | +### Placement |
| 40 | + |
| 41 | +Place a Message as close as possible to the content or action it relates to. |
| 42 | +For form-level feedback, place it at the top of the form. For page-level |
| 43 | +feedback, place it below the page header. |
| 44 | + |
| 45 | +### Dismissible Messages |
| 46 | + |
| 47 | +A Message can be made dismissible by the user via a close button (`dismissible` |
| 48 | +prop). Use this for one-off feedback following a user action, where the message |
| 49 | +does not represent an ongoing condition. |
| 50 | + |
| 51 | +Keep Messages persistent (non-dismissible) when they communicate a constraint |
| 52 | +or warning that remains relevant for the duration of the user's session on that |
| 53 | +view — for example, a permission limitation or a known degraded state. |
| 54 | + |
| 55 | +Never make `error` or `warning` messages auto-dismissing. The `autoDismiss` |
| 56 | +prop (default timeout: 10 seconds) is available but should only be used for |
| 57 | +low-stakes `info` or `success` feedback that the user does not need to act on. |
| 58 | +Be aware that an auto-dismissed Message will cause a layout shift as it |
| 59 | +disappears. |
| 60 | + |
| 61 | +## Notifications |
| 62 | + |
| 63 | +> [!NOTE] |
| 64 | +> Toast Notifications are not yet available. The NotificationsManager component |
| 65 | +> required to display them is not yet implemented. Use Messages in the meantime. |
| 66 | +
|
| 67 | +Notifications are transient, dynamic messages that appear independently of the |
| 68 | +page layout — typically as "toasts" in a fixed position on screen. Unlike |
| 69 | +Messages, they are not tied to a specific location in the UI and dismiss |
| 70 | +automatically or on user interaction. |
| 71 | + |
| 72 | +Notifications are suited for communicating events that occur asynchronously or |
| 73 | +outside the user's current focus — for example, the result of a background |
| 74 | +operation. |
0 commit comments