Introducing PrimeReact v11-alpha 🎉Discover Now
styledMessages

Message

Message component is used to display inline messages.

PrimeReact v11 is here — explore what's new.

preview

Usage#

import { Message } from '@primereact/ui/message';
<Message.Root>
    <Message.Content>
        <Message.Icon />
        <Message.Text></Message.Text>
        <Message.Close></Message.Close>
    </Message.Content>
</Message.Root>

Examples#

Basic#

An inline message for informational, success, warning, or error feedback.

Upgrade now and save %5.

basic-demo

Severity#

The severity option specifies the type of the message.

Your account is now ready.

Upgrade now and save %5.

Your subscription is about to expire. Renew

Something went wrong. Please try again.

Processing may take a few moments.

You’re currently in offline mode.

severity-demo

Icon#

Message.Icon is used to display an icon.

Your subscription is about to expire. Renew

How may I help you?

icon-demo

Variant#

Configure the variant value as outlined or simple.

Outlined

Your account is now ready.

Upgrade now and save %5.

Your subscription is about to expire. Renew

Something went wrong. Please try again.

Processing may take a few moments.

You’re currently in offline mode.

Simple

Your account is now ready.

Upgrade now and save %5.

Your subscription is about to expire. Renew

Something went wrong. Please try again.

Processing may take a few moments.

You’re currently in offline mode.

variant-demo

Sizes#

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

Upgrade now and save %5.

Upgrade now and save %5.

Upgrade now and save %5.

sizes-demo

Dynamic#

Multiple messages can be displayed.

dynamic-demo

Closable#

Message.Close is a triggerable element used to close the message.

This is a closable message.

closable-demo

Life#

Messages can disappear automatically by defined the life in milliseconds.

life-demo

API#

Sub-Components#

See Message Primitive for the full sub-component API.

Hooks#

See useMessage for the headless hook API.

Accessibility#

See Message Primitive for WAI-ARIA compliance details and keyboard support.