Message

Message component is used to display inline messages.

Message component requires a content to display.

Message Content

Message component requires a content to display.

Message Content
basic-demo

The severity option specifies the type of the message.

Success Message
Info Message
Warn Message
Error Message
Secondary Message
Contrast Message
severity-demo

The icon of a message is specified with the icon property.

Info Message
How may I help you?
icon-demo

Configure the variant value as outlined for messages with borders and no background.

Success Message
Info Message
Warn Message
Error Message
Secondary Message
Contrast Message
outlined-demo

Configure the variant value as simple for messages without borders and backgrounds.

Success Message
Info Message
Warn Message
Error Message
Secondary Message
Contrast Message
simple-demo

Message provides small and large sizes as alternatives to the base.

Small Message
Normal Message
Large Message
sizes-demo

Validation errors in a form are displayed with the error severity.

Validation Failed
Username is required
Phone number is required
form-demo

Multiple messages can be displayed using the standard for block.

dynamic-demo

Enable closable option to display an icon to remove a message.

Closable Message
closable-demo

Messages can disappear automatically by defined the life in milliseconds.

life-demo

Screen Reader

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.

Close Button Keyboard Support

KeyFunction
enterCloses the message.
spaceCloses the message.
ON THIS PAGE
PrimeBlocks
490+ ready to use UI blocks crafted with PrimeNG and Tailwind CSS.
Learn More