Message component is used to display inline messages.
import { MessageModule } from 'primeng/message';Message component requires a content to display.
The severity option specifies the type of the message.
The icon of a message is specified with the icon property.
Configure the variant value as outlined for messages with borders and no background.
Configure the variant value as simple for messages without borders and backgrounds.
Message provides small and large sizes as alternatives to the base.
Validation errors in a form are displayed with the error severity.
Multiple messages can be displayed using the standard for block.
Enable closable option to display an icon to remove a message.
Messages can disappear automatically by defined the life in milliseconds.
Message component uses alert role that implicitly defines aria-live as "assertive" and aria-atomic as "true". Since any attribute is passed to the root element, attributes like aria-labelledby and aria-label can optionally be used as well.
Close element is a button with an aria-label that refers to the aria.close property of the locale API by default.
| Key | Function |
|---|---|
| enter | Closes the message. |
| space | Closes the message. |