Message

Message component is used to display inline messages.

import { MessageModule } from 'primeng/message';

Message component requires a content to display.

Message Content

The severity option specifies the type of the message.

Success Message
Info Message
Warn Message
Error Message
Secondary Message
Contrast Message

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

Info Message
How may I help you?

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

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

Success Message
Info Message
Warn Message
Error Message
Secondary Message
Contrast Message

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

Small Message
Normal Message
Large Message

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

Validation Failed
Username is required
Phone number is required

Multiple messages can be displayed using the standard for block.

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

Closable Message

Messages can disappear automatically by defined the life in milliseconds.

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.
Templates
Highly customizable application templates to get started in no time with style. Designed and implemented by PrimeTek.