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.
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.
Result: Beta
To show a warning type.
Result: Deprecated
To show an alert type.
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.
Result: Info
With a different size
Use the size prop to adjust density. Available values are sm (default), md, and lg.
Result: small medium large
With rounded corners
Rounded corners are enabled by default. Set rounded to false to disable.
Result: pill square
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:
| Type | Border Variable | Background Variable | Text 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.
| name | type | default | description |
|---|---|---|---|
lazy | boolean | undefined | Whether to lazy load the component. |
type |
| 'info' | Controls the visual style and default icon for the component. |
label | string | undefined | Badge label. Falls back to the default slot when omitted. Supports inline Markdown. |
icon | boolean | string | false | Pass |
glow | boolean | false | Whether to enable glow effect. |
size | 'sm' | 'md' | 'lg' | 'sm' | Controls the badge density and typography. |
rounded | boolean | true | Whether to render the badge with fully rounded corners. |
iui | Record<string, string> | undefined | Special property dedicated to inline components, can be used to add TW classes for certain component markup elements. |
Slots
| name | description |
|---|---|
default | Badge label content. Ignored when the |
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.
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.
