DlBadge

Show compact type-based status labels

The DlBadge inline component displays compact status labels such as new, beta, or deprecated. It builds on the Nuxt UI Badge component and shares the same type-based colors as DlCallout. Use it for inline emphasis in content, or attach it to navigation items via frontmatter.

Features

  • 🧭 clear, aligned, type-based variants: info, note, warning, alert
  • šŸ·ļø label via prop or default slot with Markdown formatting
  • šŸŽÆ optional leading icon (type default or custom)
  • 🧩 theme-friendly visual adjustments (shared with DlCallout)
  • āš ļø extensive error reporter

Usage

Use :dl-badge as an inline component with your label provided in the default slot or the label prop.

:dl-badge[New]
:dl-badge{label="New"}

Result: New

With a dedicated type

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

  • info (default) - informational label,
  • note - helpful / contextual label,
  • warning - important / caution label,
  • alert - critical / error label.

Currently there's no way to define a custom type. Types and colors match DlCallout.


To show a note type.

:dl-badge[Beta]{type="note"}

Result: Beta

To show a warning type.

:dl-badge[Deprecated]{type="warning"}

Result: Deprecated

To show an alert type.

:dl-badge[Breaking]{type="alert"}

Result: Breaking

With an icon

By default, icons are hidden. Pass icon="true" to show the type-based Lucide icon, or provide a custom Iconify / Lucide name.

:dl-badge[Info]{type="info" icon="true"}

Result: Info

With a different size

Use the size prop to adjust density. Available values are sm (default), md, and lg.

:dl-badge[Small]{size="sm"} :dl-badge[Medium]{size="md"} :dl-badge[Large]{size="lg"}

Result: small medium large

With rounded corners

Rounded corners are enabled by default. Set rounded to false to disable.

:dl-badge[Pill]{rounded="true"} :dl-badge[Square]{rounded="false"}

Result: pill square

With a glow effect

Set glow to true to enable a subtle glow effect.

:dl-badge[Glow]{glow="true"}

Result: glow

In navigation

DlBadge powers navigation badges as we explained here.

Configuration

DlBadge uses sensible defaults and does not require global configuration. It reuses the same CSS variables as DlCallout for borders, text, and backgrounds, so badges and callouts stay visually consistent.

Colors via CSS variables

The component binds its colors to the following CSS variables:

TypeBorder VariableBackground VariableText Variable
note--dl-badge-note-border
--dl-badge-note-bg
--dl-badge-note-text
info--dl-badge-info-border--dl-badge-info-bg--dl-badge-info-text
warning--dl-badge-warning-border--dl-badge-warning-bg--dl-badge-warning-text
alert--dl-badge-alert-border--dl-badge-alert-bg--dl-badge-alert-text

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

Props

Here are the properties you can use with the DlBadge 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 default icon for the component.

labelstringundefined

Badge label. Falls back to the default slot when omitted. Supports inline Markdown.

iconboolean | stringfalse

Pass true for the type default icon, a Lucide (without prefix) name for a custom icon, or false to hide.

glowbooleanfalse

Whether to enable glow effect.

size'sm' | 'md' | 'lg''sm'

Controls the badge density and typography.

roundedbooleantrue

Whether to render the badge with fully rounded corners.

iuiRecord<string, string>undefined

Special property dedicated to inline components, can be used to add TW classes for certain component markup elements.

Slots

namedescription
default

Badge label content. Ignored when the label prop is provided.

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-border-radius', 'border', 'font-medium', 'inline-flex', 'items-center', 'py-[0.5rem]', 'px-1'],  leadingIcon: [],  label: [],});</script>

CSS Variables

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

@theme {  --dl-badge-info-border: var(--app-callout-info-border);  --dl-badge-info-text: var(--app-callout-info-text);  --dl-badge-info-bg: var(--app-callout-info-bg);  --dl-badge-note-border: var(--app-callout-note-border);  --dl-badge-note-text: var(--app-callout-note-text);  --dl-badge-note-bg: var(--app-callout-note-bg);  --dl-badge-warning-border: var(--app-callout-warning-border);  --dl-badge-warning-text: var(--app-callout-warning-text);  --dl-badge-warning-bg: var(--app-callout-warning-bg);  --dl-badge-alert-border: var(--app-callout-alert-border);  --dl-badge-alert-text: var(--app-callout-alert-text);  --dl-badge-alert-bg: var(--app-callout-alert-bg);}

Icons

DlBadge uses Iconify with the lucide icon set as the default collection, so you can specify icons without a prefix. If you set icon to true, the icon is chosen automatically based on the type (using the same mapping as DlCallout).