Skip to content
Foldocs
On this pageExample
Components

Dynamic code block

Highlight a code string supplied through component attributes.

Use DynamicCodeBlock when code is generated or supplied as a string instead of written in a Markdown fence. Foldocs sends it through the same build-time Shiki pipeline as every other code block.

Example

ts
const documentation: string = 'static and typed'
mdx
<DynamicCodeBlock
  lang="ts"
  code="const documentation: string = 'static and typed'"
/>

Properties

PropertyTypeDescription
codestringSource passed to the highlighter.
langstringShiki language identifier.
languagestringAlias for lang.
metastringOptional metadata forwarded to the highlighter.

The compiled result is a normal Foldocs code block, including its stable copy action and accessible source text.

Last updated Aug 2, 2026