The DlCodeInline inline component renders a semantic <code> snippet with the same look as Markdown backticks, but keeps the text on a single line. Use it when backtick code would wrap in prose, or when you need inline code inside tables and other tight layouts.
The Why
DocLayer styles regular inline code with wrap-anywhere inside paragraphs and lists, so long identifiers can break across lines. Tables already force whitespace-nowrap on native code elements, but that behavior is not consistent everywhere. DlCodeInline applies a small, overridable UI layer so authors can opt into nowrap inline code without custom HTML or inline style attributes.
Features
- 📎 semantic
<code>output (inherits global inline code theme) - ↔️ keeps snippets on one line (
whitespace-nowrap) - đź§© works with default slot or
codeprop - 🎛️ stylable via
iui/#uionbase - ⚠️ extensive error reporter when content is missing
Usage
Use :dl-code-inline as an inline component with the snippet in the default slot or the code prop.
Result: content.config.ts
Within tables
Prefer the code prop when the snippet contains characters that confuse MDC or table syntax (for example | in TypeScript unions).
See also the writing guide for more table recipes.
Compared with backticks and DlFormat
- Markdown backticks are best for short inline mentions in running text.
DlFormatparses lightweight Markdown (bold, italic, nested backticks) into HTML.DlCodeInlineis for a literal code string that must stay on one line and should not be reformatted.
Props
Here are the properties you can use with the DlCodeInline 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 | false | Whether to lazy load the component. |
code | string | undefined | Inline code snippet. Use when the default slot is impractical (tables, pipes, or other MDC edge cases). |
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 | Code snippet text. 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.
DlCodeInline relies on global code styles for colors, padding, and borders. The component UI only adds layout overrides:
Override defaults per instance with :iui, or globally via dl.components when supported.
Accessibility
DlCodeInline renders a native <code> element with an accessible name. Keep snippets short and meaningful; use surrounding prose to explain longer references.
