Skip to content

Callout Examples

The examples below assume that you have imported the component and set up the theme.

Basic

Set a remark apart from the text around it, with an icon and a title that name its kind. An sv-callout with no type is a note, with the info icon and "Note" as its title.

The controls switch the type and fold the body under the title.

Reduced Motion

Your system is set to reduce motion. The fold animation will not play for you.

Large exports run in the background. You can close this page, and the file arrives by email when it is ready.

type
fold
<div class="callout-basic">
<sv-callout>
<p>
Large exports run in the background. You can close this page, and the file arrives by email
when it is ready.
</p>
</sv-callout>
</div>
<style>
.callout-basic {
display: grid;
inline-size: min(100%, 32rem);
margin-inline: auto;
}
</style>

Title

Name a callout after what it says, in place of its type. A <span slot="title"> replaces "Warning" on screen, and screen readers still read "Warning:" before it.

Back up before you migrate

The migration rewrites every record in place. It cannot be undone.

<div class="callout-title">
<sv-callout type="warning">
<span slot="title">Back up before you migrate</span>
<p>The migration rewrites every record in place. It cannot be undone.</p>
</sv-callout>
</div>
<style>
.callout-title {
inline-size: min(100%, 32rem);
margin: 1em auto;
}
</style>

Icon

Show an icon of your own in place of the built-in one. An element with slot="icon" replaces the icon of the type, and aria-hidden="true" keeps the emoji out of what screen readers read.

Press / anywhere on the page to jump to the search field.

<div class="callout-icon">
<sv-callout type="tip">
<span aria-hidden="true" slot="icon">🔍</span>
<p>
Press
<kbd>/</kbd>
anywhere on the page to jump to the search field.
</p>
</sv-callout>
</div>
<style>
.callout-icon {
inline-size: min(100%, 32rem);
margin: 1em auto;
}
</style>

After the Title

Put a button in the title row of a folded callout, like an update action. slot="after" places the button at the end of the title row of a collapsible callout, where a click on it does not fold the callout.

Version 2.4 is ready

This version adds offline mode and fixes the sync delay on slow networks.

<div class="callout-after">
<sv-callout collapsible>
<span slot="title">Version 2.4 is ready</span>
<button class="btn" slot="after">Update</button>
<p>This version adds offline mode and fixes the sync delay on slow networks.</p>
</sv-callout>
</div>
<style>
.callout-after {
inline-size: min(100%, 32rem);
margin: 1em auto;
[slot="after"] {
padding: 0.25em 0.75em;
font-size: 0.875em;
}
}
</style>

Custom Type

Add a kind of callout of your own, like a known bug. type="bug" matches the --sv-callout-clr rule in the style, type-label="Known bug" names it in the title, and the <svg slot="icon"> replaces the built-in icon.

Sorting a table with empty cells puts them first. A fix ships in the next release.

<div class="callout-custom-type">
<sv-callout type="bug" type-label="Known bug">
<!-- Bug -->
<svg aria-hidden="true" slot="icon" viewBox="0 0 24 24">
<path
d="M8 9a4 4 0 0 1 8 0v6a4 4 0 0 1-8 0zm4 2v8M8 13H3m18 0h-5M9 6 7 3m8 3 2-3M8 17l-4 3m12-3 4 3"
/>
</svg>
<p>Sorting a table with empty cells puts them first. A fix ships in the next release.</p>
</sv-callout>
</div>
<style>
.callout-custom-type {
inline-size: min(100%, 32rem);
margin: 1em auto;
sv-callout[type="bug"] {
--sv-callout-clr: var(--sv-error);
}
svg {
fill: none;
stroke: currentcolor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
}
}
</style>