Message plugin
Frontfire UI provides a set of message bar styles that can be used to inform the user about success or error messages at different levels.
Messages, or message boxes, can be used to highlight important or informative notifications to the user.
They are often used at the top of a form to inform the user about the issues that occurred while processing the form data provided.
There are several message levels, ordered by severity.
The described CSS classes can be added to <div>
or <p>
elements.
This plugin is available in the Minimal and Complete bundles.
Message styles
These are the default message styles.
All messages must have the message
CSS class.
Depending on the level, you should also add one of the critical
, error
, warning
, information
or success
classes.
The transparent
class is used for messages without any background or padding.
It is most useful with an icon.
The message box colours can be customised with the CSS variables
--critical-background
, --critical-color
,
--error-background
, --error-color
,
--warning-background
, --warning-color
,
--information-background
, --information-color
,
--success-background
and --success-color
.
These message type CSS classes are nothing fancy, you can also create your own and use them in the same way if you like.
Messages with an icon
The icon needs to be included in the markup manually, so you have total freedom about whether or not and which icon from which source (graphics, font) to use.
When using an icon, the additional icon
CSS class must be applied to provide some space at the left side.
Closable messages
A message can be discarded by the user by clicking on a close button, if you add the closable
CSS class to the message element or call the closableMessage()
plugin method on it.
Plugin methods
This plugin provides methods to control the closable message.
close
close()
→ this
Closes the selected message as if the close button was clicked.