Design
Messages are used to provide clarity on the status of the product or an action. They may be informational; indicate success or failure for an interaction; or alert the user to a system failure.
Messages have two behaviours:
- timed, where the message disappears without user interaction
- persistent, where the message does not disappear unless the user chooses to dismiss it
Example | Name | Comments |
---|---|---|
Information | Mostly used for persistent messages that aren’t specifically success or error messages. Note that empty result sets from search and filter actions are displayed in default messages, not errors (a search which accurately returns zero results is not an error, just a result). | |
Success | Mostly used for timed messages that display when an action is successful. | |
Error | Mostly used for timed messages that display when an action is unsuccessful. | |
Critical | Used for persistent messages that indicate a major failure. | |
Close | Used for closing persistent messages. | |
Action | Used for adding a contextual actions to persistent messages. | |
Multi-line | Messages work when there is more text to display. Messages should still be crafted as concisely as possible without losing clarity. | |
Large messages | Large, default messages can be used to indicate states which are not errors but have no information to display, such as a succesful search which returned zero results. | |
Large message with buttons. | Large messages are often used to indicate an initial or 'empty' state, which the user may be keen to change. For example if there are no documents, a button should be provided to upload their first document. | |
Page context messages | Page context messages can be used to indicate that a message is contextual to the whole page. There must only ever be ONE page context message active at a time. It is up to the application to enforce this. |
Code
Messages are primarily used in general body content. Critical Error should be used sparingly.
Example | Element | Code |
---|---|---|
Default message. |
|
|
Success message. |
|
|
Error message. |
|
|
Critical error message. |
|
|
Closable message. |
|
|
Closable message custom close icon text. |
|
|
Large message. |
Note: track ACE-1049 for support in ASP templates.
|
|
Large message with buttons. |
|
|
Page context message |
Note: the page context message must be rendered in the #hidden section
Note: the page context message must be rendered in the #hidden section Note: track ACE-1207 for support in ASP templates.
|
|
Page context message that auto closes |
Note: the page context message must be rendered in the #hidden section
Note: the page context message must be rendered in the #hidden section Note: track ACE-1207 for support in ASP templates.
|
Message Attributes
Element | Attributes | Description |
---|---|---|
.ace-message
|
.ace-message-default , .ace-message-success , .ace-message-error , .ace-message-criticalerror
|
Sets type of message. |
.ace-message
|
data-ace-closeable="true"
|
Makes the message closable. Requires the closing span element (see example above). |
.ace-message
|
data-ace-closeabletext="text"
|
Adds alternative text for closeable icon control. |
Name | Description |
---|---|
id | Sets ID |
customclass | Adds a custom class |
type | Sets type. options:["default", "success", "error", "criticalerror"]
|
closeable | Makes message closeable. options:[True, Empty]
|
context | Sets the context for this message. options:["default", "page"]
|
Javascript
Events
Event | Description | Example Usage |
---|---|---|
messageRemoved | Message element been removed from DOM. Call preventDefault on this event to prevent the element from being removed |
|
Optional Methods
Function | Arguments | Description | Example Usage |
---|---|---|---|
init | elementSelector | Bind all the events to message. |
|
destroy | elementSelector | Removes the event bindings from messages. |
|
show | elementSelector | Shows a message. |
|
hide | elementSelector | Hides a message. |
|