View as Markdown

API reference: @salmonui/notifications/message

MessagePropsinterface

import type { MessageProps } from '@salmonui/notifications/message';
interface MessageProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
    children?: ReactNode;
    tone?: MessageTone | undefined;
    variant?: MessageVariant | undefined;
    title?: ReactNode;
    icon?: ReactNode | false;
    action?: ReactNode;
    onDismiss?: ((event: MouseEvent<HTMLButtonElement>) => void) | undefined;
    hidden?: boolean | undefined;
    align?: 'start' | 'center' | 'end' | undefined;
    live?: 'polite' | 'assertive' | false | undefined;
    localeText?: Partial<MessageLocaleText> | undefined;
    ref?: Ref<HTMLDivElement> | undefined;
}
MessageProps members (12)
NameSignatureDescription
childrenoptionalchildren?: ReactNode;

The message content.

toneoptionaltone?: MessageTone | undefined;

Color role. Default 'neutral'.

variantoptionalvariant?: MessageVariant | undefined;

Visual weight. Default 'soft'.

titleoptionaltitle?: ReactNode;

Heading line above the content.

iconoptionalicon?: ReactNode | false;

Replaces the built-in tone icon; false hides it. Always decorative.

actionoptionalaction?: ReactNode;

Actions after the content, usually a Button.

onDismissoptionalonDismiss?: ((event: MouseEvent<HTMLButtonElement>) => void) | undefined;

Shows the close button; the application then hides or unmounts the message.

hiddenoptionalhidden?: boolean | undefined;

Hides the message; with live the live region stays mounted.

alignoptionalalign?: 'start' | 'center' | 'end' | undefined;

Inline alignment of the content. Default 'start'.

liveoptionallive?: 'polite' | 'assertive' | false | undefined;

Announce the message: 'polite' renders it in a role="status" region, 'assertive' in role="alert". Default false: static page content, not announced on load.

localeTextoptionallocaleText?: Partial<MessageLocaleText> | undefined;

Overrides of the built-in strings.

refoptionalref?: Ref<HTMLDivElement> | undefined;

The message element.