skip section navigation

Callout

use Callout for a short message that changes how someone approaches the surrounding task. give them the useful detail, not just a colored box.

Keep a local copy

Export your reading list before clearing this browser's storage.

usage

svelte
<script>
	import { Callout } from '@ciabi/loafkit-ui';
	import calloutArtwork from '$lib/assets/emotions/surprised.png';
</script>

<Callout variant="warning" title="Keep a local copy">
	<p>Export your reading list before clearing this browser's storage.</p>
</Callout>

composition

  • Callout
    • icon()(optional)
    • children(optional)

message types

variantdefault titleuse
infoNoterelevant context
tipTipan easier way to do the task
warningWarninga condition to check before proceeding
dangerErrora failure or destructive consequence

match the message to the task

a local copy

the export includes articles saved in this browser.

svelte
<script lang="ts">
import { Callout, Selector } from '@ciabi/loafkit-ui';
let exportSituation = $state<'info' | 'tip' | 'warning' | 'danger'>('info');
const exportMessages = {
	info: { title: 'a local copy', text: 'the export includes articles saved in this browser.' },
	tip: { title: 'check the links first', text: 'open each link once so you do not export a broken reading list.' },
	warning: { title: 'three articles are missing titles', text: 'add their titles before sharing the collection.' },
	danger: { title: 'the export could not be prepared', text: 'your saved articles are still here. try the export again.' }
};
</script>

<Selector label="export situation" selected={exportSituation} onValueChange={value => exportSituation = value as typeof exportSituation}
	options={Object.entries(exportMessages).map(([value,message]) => ({value,label:message.title}))} />
<div aria-live="polite">
	<Callout variant={exportSituation} title={exportMessages[exportSituation].title}>
		<p>{exportMessages[exportSituation].text}</p>
	</Callout>
</div>

Callout itself is not an alert. its icon is decorative, so the title and message need to carry the meaning.

a custom heading and symbol

keep one useful detail

a short note is easier to return to than another open tab.

svelte
<script lang="ts">
	import { Callout } from '@ciabi/loafkit-ui';
	import calloutArtwork from '$lib/assets/emotions/surprised.png';
</script>

<Callout variant="tip" title="keep one useful detail">
	{#snippet icon()}<img src={calloutArtwork} alt="" style="width: 1.25rem; height: 1.25rem; object-fit: cover;" />{/snippet}
	<p>a short note is easier to return to than another open tab.</p>
</Callout>

API reference

Callout

Component
variant
Default: 'info'

the message category and semantic color treatment.

title

overrides the category’s default heading.

icon

replaces the decorative category symbol.

children

the message body.