DlCallout

Display notes, warnings, and alerts as type-based callout blocks

The DlCallout block component displays attention-grabbing information blocks such as notes, info messages, and warnings. It supports a customizable title, type-based styling, and seamless content page integration. Use this component whenever you want to emphasize important information within your content.

Features

  • 🧭 clear, type-based variants: info, note, warning, alert
  • šŸ·ļø optional, customizable title with icon and Markdown formatting
  • 🧩 theme-friendly visual adjustments
  • āš ļø extensive error reporter

Usage

Use the ::dl-callout as a block component with your content provided in the default slot.

::dl-calloutThis is an informational message.::

Result:

This is an informational message.

With a dedicated type

To change the appearance, set the type prop. Available values are:

  • info (default) - informational message,
  • note - helpful note,
  • warning - important / alarming notice,
  • alert - critical / error message.

Currently there's no way to define a custom type.


To show a note type.

::dl-callout{type="note"}This is a helpful note.::

Result:

This is a helpful note.

To show a warning type.

::dl-callout{type="warning"}Proceed with caution.::

Result:

Proceed with caution.

With a custom title

To provide a custom title, use the title prop.

::dl-callout{type="note" title="Custom Title"}You can customize the title to better describe the message.::

Result:

Custom Title

You can customize the title to better describe the message.

With a hidden title

To hide the title (and icon), set title to false or 'false' (string).

::dl-callout{type="info" title="false"}This callout is rendered without a title.::

Result:

This callout is rendered without a title.

Configuration

DlCallout uses sensible defaults and does not require global configuration. However, it integrates with your theme via dedicated CSS variables for borders and backgrounds, allowing you to keep styling consistent across the app.

Colors via CSS variables

The component binds its colors to the following CSS variables:

TypeBorder VariableBackground VariableText Variable
note--app-callout-note-border--app-callout-note-bg--app-callout-note-text
info--app-callout-info-border--app-callout-info-bg--app-callout-info-text
warning--app-callout-warning-border--app-callout-warning-bg--app-callout-warning-text
alert--app-callout-alert-border--app-callout-alert-bg--app-callout-alert-text

Define or override them in your style.css file to match your desired effect. Bellow you can check the default values assigned to these variables.

Props

Here are the properties you can use with the DlCallout component. Each property should be set on an individual component instance; they do not affect the global configuration. More about defining properties in MDC components you can read here.

nametypedefaultdescription
lazybooleanundefined

Whether to lazy load the component.

type

'info'
'note'
'warning'
'alert'

'info'

Controls the visual style and icon for the component.

titlestring | boolean

empty string

Custom title text. Pass false (or 'false') to hide the title and icon.

Slots

namedescription
default

Default slot for the callout content.

ui

Dedicated slot for defining the component’s ui object. More about styling MDC components you can read here.

Styling

Styling from Markdown

Every DocLayer component can be styled directly within your Markdown file using dedicated slot/property configuration. This allows you to customize the appearance of the component's markup elements without modifying global styles. More about components styling you can read here.

Below you'll find the default set of Tailwind classes for the component's dedicated markup elements.

<script lang="ts">const ui = defineDoclayerComponentUi({  base: ['u-space-p', 'u-space-mt', 'u-border-radius', 'border-1'],  title: ['u-text-weight-black', 'flex', 'items-center', 'gap-4', 'md:gap-2', 'mb-4', 'w-full'],  icon: ['w-6', 'h-6'],});</script>

CSS Variables

Here is a set of CSS variables you can use to customize the appearance of the DlCallout component globally. More about theming and styling with CSS variables, you can read here.

@theme {  --app-callout-info-border: light-dark(var(--color-green-400), var(--color-green-800));  --app-callout-info-text: var(--color-green-500);  --app-callout-info-bg:    to right bottom, color-mix(in srgb, light-dark(var(--color-green-50), var(--color-green-800)) 20%, transparent) 10%,    color-mix(in srgb, light-dark(var(--color-green-300), var(--color-green-900)) 10%, transparent) 90%;  --app-callout-note-border: light-dark(var(--color-sky-400), var(--color-sky-900));  --app-callout-note-text: var(--color-sky-600);  --app-callout-note-bg:    to right bottom, color-mix(in srgb, light-dark(var(--color-sky-100), var(--color-sky-800)) 20%, transparent) 10%,    color-mix(in srgb, light-dark(var(--color-sky-300), var(--color-sky-900)) 10%, transparent) 90%;  --app-callout-warning-border: light-dark(var(--color-amber-300), var(--color-amber-800));  --app-callout-warning-text: var(--color-amber-500);  --app-callout-warning-bg:    to right bottom, color-mix(in srgb, light-dark(var(--color-amber-50), var(--color-amber-800)) 20%, transparent) 10%,    color-mix(in srgb, light-dark(var(--color-amber-200), var(--color-amber-900)) 10%, transparent) 90%;  --app-callout-alert-border: light-dark(var(--color-rose-300), var(--color-rose-900));  --app-callout-alert-text: var(--color-rose-500);  --app-callout-alert-bg:    to right bottom, color-mix(in srgb, light-dark(var(--color-rose-50), var(--color-rose-800)) 20%, transparent) 10%,    color-mix(in srgb, light-dark(var(--color-rose-300), var(--color-rose-900)) 10%, transparent) 90%;}

Icons

DlCallout uses Iconify with the lucide collection under the hood. Icons are automatically selected per type.