Browse documentation

Historical template

Code Block (Dynamic)

A codeblock that also highlights code

Historical Fumadocs template

Historical template documentation, retained for existing links. It is not current ClaudeSkills product guidance.

This article has no translation in the selected language. The English body is shown.

The navigation uses English labels. Article languages are shown separately; the interface is not a full translation of the documentation.

On this page

Usage

import { DynamicCodeBlock } from 'fumadocs-ui/components/dynamic-codeblock';

<DynamicCodeBlock lang="ts" code='console.log("Hello World")' />;

This component, different from the MDX CodeBlock component, can be used without MDX. It highlights the code with Shiki and use the default component to render it.

Features:

  • Can be pre-rendered on server
  • load languages and themes on browser lazily

Options

import { DynamicCodeBlock } from 'fumadocs-ui/components/dynamic-codeblock';

<DynamicCodeBlock
  lang="ts"
  code='console.log("Hello World")'
  options={{
    components: {
      // add/override components
    },
    // or Shiki options
  }}
/>;