Configuration

Set package options with the contentMermaid key in nuxt.config.ts:

export default defineNuxtConfig({
  contentMermaid: {
    loader: { lazy: true },
    theme: { light: 'default', dark: 'dark' },
  },
})

General

OptionTypeDefaultPurpose
enabledbooleantrueEnables the module and Markdown transformation at Nuxt startup.
debugbooleanfalseEnables more detailed package diagnostics.

enabled is a build-time module option. Keep it under contentMermaid, not public runtime configuration.

Loading and Mermaid initialization

OptionTypeDefaultPurpose
loader.lazyboolean or options objectenabledWaits until a diagram enters the viewport. Set false to load immediately.
loader.lazy.thresholdnumberno package valueSets the IntersectionObserver visibility threshold.
loader.initpure-data Mermaid configurationpackage defaultsPasses initialization options to Mermaid.

See Writing Diagrams for page and diagram overrides.

Theme

OptionTypeDefaultPurpose
theme.lightMermaid theme namedefaultTheme used in light color mode.
theme.darkMermaid theme namedarkTheme used in dark color mode.

When @nuxtjs/color-mode is installed, the renderer follows the current color mode. You can also control the active mode with useMermaidTheme().

Custom components

OptionTypeDefaultPurpose
components.renderercomponent namebuilt-in rendererReplaces diagram rendering with an application component.
components.spinnercomponent namenoneSupplies a loading component.
components.errorcomponent namenoneSupplies a rendering-error component.

Use the registered name of a component from your Nuxt application. If a custom renderer name cannot be resolved, the package falls back to its built-in renderer.

Expand

Set expand: false to disable expanding, expand: true to use all defaults, or provide an options object:

OptionTypeDefaultPurpose
expand.enabledbooleantrueEnables expand interactions.
expand.marginnumber0Keeps this many pixels around the expanded diagram.
expand.invokeOpenOn.diagramClickbooleantrueOpens the overlay when the diagram is clicked.
expand.invokeCloseOn.escbooleantrueCloses with Escape.
expand.invokeCloseOn.wheelbooleantrueCloses on a wheel action.
expand.invokeCloseOn.swipebooleantrueCloses on a swipe.
expand.invokeCloseOn.overlayClickbooleantrueCloses when the overlay background is clicked.
expand.invokeCloseOn.closeButtonClickbooleantrueShows and enables the close button.

Toolbar

OptionTypeDefaultPurpose
toolbar.titlestringmermaidSets the default toolbar title.
toolbar.fontSizestring or number14pxSets the toolbar font size.
toolbar.fullscreenToolbarScalenumber1.25Scales toolbar text and icons in fullscreen.
toolbar.buttons.copybooleantrueShows the copy-source button.
toolbar.buttons.fullscreenbooleantrueShows the fullscreen button.
toolbar.buttons.expandbooleantrueShows the expand button.

Mermaid-owned configuration

loader.init, page configuration, and direct component configuration pass values to Mermaid, but this package does not redefine Mermaid's option schema or behavior. Use the official Mermaid configuration documentation for native themes, diagram options, security settings, and directives.