SectionMessage

A message inside the content that stays there: a note, a tip, a warning, or an error.

Primary

For general information and notes.

Preparing environment...

svelte
svelte
<SectionMessage appearance="primary">Your changes are saved when you leave this page.</SectionMessage>

Success

For the confirmation that something worked.

Preparing environment...

svelte
svelte
<SectionMessage appearance="success">Your changes are saved when you leave this page.</SectionMessage>

Warning

For something that may go wrong or needs attention. Screen readers announce it at once.

Preparing environment...

svelte
svelte
<SectionMessage appearance="warning">Your changes are saved when you leave this page.</SectionMessage>

Danger

For errors and things that need action. Screen readers announce it at once.

Preparing environment...

svelte
svelte
<SectionMessage appearance="danger">Your changes are saved when you leave this page.</SectionMessage>

Discover

For a tip or something new that the user can try.

Preparing environment...

svelte
svelte
<SectionMessage appearance="discover">Your changes are saved when you leave this page.</SectionMessage>

Title

A short heading above the text, for a message with more to say.

Preparing environment...

svelte
svelte
<SectionMessage appearance="warning" title="Before you continue">Your changes are saved when you leave this page.</SectionMessage>

Icon

Every appearance has its own icon. Pass icon to use another one, and iconVariant to set its style.

Preparing environment...

svelte
svelte
<SectionMessage appearance="success" icon="task_alt">Your changes are saved when you leave this page.</SectionMessage>

Actions

Buttons or links below the text, for what the user can do about the message.

svelte
svelte
<SectionMessage appearance="warning" title="Before you continue">
	Your changes are saved when you leave this page.
	{#snippet actions()}
		<Button appearance="subtle">Review changes</Button>
	{/snippet}
</SectionMessage>

Dismiss

The close button is there when onDismiss is passed. The message does not remove itself: the page that shows it decides.

Your changes are saved when you leave this page.
svelte
svelte
{#if visible}
	<SectionMessage appearance="discover" onDismiss={() => (visible = false)}>
		Your changes are saved when you leave this page.
	</SectionMessage>
{/if}