The DlImage inline component renders images with optional captions, visually integrating them into your content. It is based on NuxtImg, providing integrated image compression and caching.
The Why
Adding images in Markdown is simple, but keeping consistent styling, spacing, borders, and captions across a large applications can be tedious. DlImage centralizes these concerns and makes images easy to standardize, while still letting you customize visuals inline when needed.
Features
- 🖼️ simple, declarative image rendering
- 🏷️ optional caption with Markdown formatting
- đź§© theme-friendly visual adjustments
- 🔄 consistent spacing, border, and radius across docs
- 🤏 sensible defaults with accessibility in mind
- ⚠️ extensive error reporter
Usage
Use :dl-image[...] as an inline component with the image source provided either as the default slot or via the src property. Always include an alt attribute for the best accessibility.
Result:

With a caption
Captions support Markdown formatting, allowing you to create expressive and consistent descriptions. This is especially useful for highlighting code, UI elements, or providing additional context.
Result:

result layout.With a filename
Additionally, you can set the filename prop to true to display the file name alongside the caption.
Result:

Styled inline
You can customize the component’s classes directly from Markdown using the iui slot, following the same rules as for component styling.
Result:

Configuration
Because the DlImage component is built on top of NuxtImg, it supports all configuration options available to the component. You can modify these options in your nuxt.config.ts file. Here you can check the default internal setup.
Props
Here are the properties you can use with the DlImage 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. |
src | string | undefined | Image source URL. Must be publicly reachable or handled by your image provider. |
alt | string | Image | Alternative text for accessibility. Provide a descriptive value whenever the image conveys meaning. |
caption | string | undefined | Optional caption, supports Markdown formatting. |
filename | boolean | false | Whether to display the file name (from the image source) in the caption. |
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 | Default slot for the image source. You can use it interchangeably with 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.
Accessibility
Alternative (alt) text. While the DlImage component will automatically add a generic alt text if none is provided, you should always define a meaningful alt attribute whenever the image conveys information. If the image is purely decorative, leave alt as it is in non-critical contexts.
Captions. Use captions to provide context, especially for screenshots and diagrams. Captions are particularly helpful when presenting code screenshots, as they offer additional information that connects the image to the surrounding content.
