Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/facebook/docusaurus/llms.txt

Use this file to discover all available pages before exploring further.

The themeConfig object in docusaurus.config.js is where you configure every visual and behavioral aspect of your Docusaurus theme — from color mode preferences and the navbar layout to syntax highlighting and table of contents depth. All options described here apply to @docusaurus/theme-classic and are intended to be shared by any future main themes as well.

Comprehensive example

The snippet below shows the full shape of themeConfig with every major section populated. Individual options are explained in detail in the sections that follow.
docusaurus.config.js
import {themes as prismThemes} from 'prism-react-renderer';

export default {
  themeConfig: {
    // Color mode
    colorMode: {
      defaultMode: 'light',
      disableSwitch: false,
      respectPrefersColorScheme: true,
    },

    // Global meta image
    image: 'img/social-card.png',

    // Extra <meta> tags
    metadata: [
      {name: 'twitter:card', content: 'summary_large_image'},
    ],

    // Announcement bar
    announcementBar: {
      id: 'v3_announcement',
      content: 'Docusaurus v3 is here! <a href="/blog/releases/3.0">Read the release notes</a>.',
      backgroundColor: '#fafbfc',
      textColor: '#091E42',
      isCloseable: true,
    },

    // Navbar
    navbar: {
      title: 'My Site',
      logo: {
        alt: 'My Site Logo',
        src: 'img/logo.svg',
        srcDark: 'img/logo_dark.svg',
      },
      hideOnScroll: false,
      style: 'primary',
      items: [
        {type: 'doc', docId: 'intro', label: 'Docs', position: 'left'},
        {to: '/blog', label: 'Blog', position: 'left'},
        {type: 'docsVersionDropdown', position: 'right'},
        {type: 'localeDropdown', position: 'right'},
        {
          href: 'https://github.com/example/repo',
          label: 'GitHub',
          position: 'right',
        },
      ],
    },

    // Footer
    footer: {
      style: 'dark',
      logo: {
        alt: 'My Site Logo',
        src: 'img/logo.svg',
        href: 'https://example.com',
        width: 160,
      },
      copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc.`,
      links: [
        {
          title: 'Docs',
          items: [
            {label: 'Getting Started', to: '/docs/intro'},
          ],
        },
        {
          title: 'Community',
          items: [
            {label: 'Discord', href: 'https://discord.gg/example'},
          ],
        },
      ],
    },

    // Syntax highlighting
    prism: {
      theme: prismThemes.github,
      darkTheme: prismThemes.dracula,
      defaultLanguage: 'javascript',
      additionalLanguages: ['bash', 'diff', 'json'],
    },

    // Table of contents
    tableOfContents: {
      minHeadingLevel: 2,
      maxHeadingLevel: 4,
    },

    // Docs plugin overrides
    docs: {
      versionPersistence: 'localStorage',
      sidebar: {
        hideable: true,
        autoCollapseCategories: true,
      },
    },

    // Blog plugin overrides
    blog: {
      sidebar: {
        groupByYear: true,
      },
    },
  },
};

Color mode

The classic theme provides light and dark mode out of the box, with a toggle in the navbar. Configure it using the colorMode object.
OptionTypeDefaultDescription
defaultMode'light' | 'dark''light'Color mode applied when a user visits the site for the first time.
disableSwitchbooleanfalseHides the color mode toggle in the navbar. Useful for single-theme sites.
respectPrefersColorSchemebooleanfalseWhen true, uses the OS-level prefers-color-scheme preference instead of defaultMode.
docusaurus.config.js
export default {
  themeConfig: {
    colorMode: {
      defaultMode: 'light',
      disableSwitch: false,
      respectPrefersColorScheme: true,
    },
  },
};
When respectPrefersColorScheme is true, the defaultMode setting is ignored — user system preferences take precedence. If you want a fixed color mode that ignores system settings, keep respectPrefersColorScheme: false and set disableSwitch: true.

The navbar object controls the top navigation bar, including its title, logo, link items, scroll behavior, and style.

Top-level navbar options

OptionTypeDefaultDescription
titlestringundefinedText displayed next to the logo.
logoLogoundefinedLogo image configuration (see below).
itemsNavbarItem[][]Array of items to render in the navbar.
hideOnScrollbooleanfalseWhen true, the navbar slides out of view when the user scrolls down and reappears on scroll up.
style'primary' | 'dark'Follows color themeForces a static navbar style independent of the active color mode.
OptionTypeDefaultDescription
altstringundefinedAlt text for the logo image.
srcstringRequiredPath to the logo image (relative to the static/ directory).
srcDarkstringSame as srcAlternative image used in dark mode.
hrefstringSite base URLURL the logo links to when clicked.
targetstringAuto-detectedThe target attribute of the logo anchor tag.
widthstring | numberundefinedWidth of the logo image.
heightstring | numberundefinedHeight of the logo image.
classNamestringundefinedCSS class applied to the <img> element.
styleobjectundefinedInline React style object applied to the <img> element.
docusaurus.config.js
export default {
  themeConfig: {
    navbar: {
      logo: {
        alt: 'My Site Logo',
        src: 'img/logo.svg',
        srcDark: 'img/logo_dark.svg',
        href: 'https://mysite.com',
        width: 32,
        height: 32,
      },
    },
  },
};
Renders a dropdown listing all available documentation versions, letting users switch versions while staying on the same document.
OptionTypeDefaultDescription
type'docsVersionDropdown'RequiredSets the item type.
position'left' | 'right''left'Side of the navbar.
dropdownItemsBeforeLinkLikeItem[][]Extra items prepended to the dropdown list.
dropdownItemsAfterLinkLikeItem[][]Extra items appended to the dropdown list.
docsPluginIdstring'default'Docs plugin instance.
dropdownActiveClassDisabledbooleanfalsePrevents the active-link class from being applied.
versionsDropdownVersionsundefinedExplicit list of versions to include.
docusaurus.config.js
{
  type: 'docsVersionDropdown',
  position: 'right',
  dropdownItemsAfter: [{to: '/versions', label: 'All versions'}],
}
Renders a dropdown with all configured locales so users can switch languages while remaining on the same page.
OptionTypeDefaultDescription
type'localeDropdown'RequiredSets the item type.
position'left' | 'right''left'Side of the navbar.
dropdownItemsBeforeLinkLikeItem[][]Extra items prepended to the dropdown.
dropdownItemsAfterLinkLikeItem[][]Extra items appended to the dropdown.
queryStringstringundefinedQuery string appended to the URL on locale switch.
docusaurus.config.js
{
  type: 'localeDropdown',
  position: 'right',
  dropdownItemsAfter: [{to: '/help-translate', label: 'Help us translate'}],
}
Renders arbitrary HTML inside a navbar item. Useful for badges, images, or custom interactive elements.
OptionTypeDefaultDescription
type'html'RequiredSets the item type.
valuestring''HTML string to render.
position'left' | 'right''left'Side of the navbar.
classNamestring''CSS class on the wrapper element.
docusaurus.config.js
{type: 'html', position: 'right', value: '<button>Feedback</button>'}

The footer object controls the site footer, including its color style, logo, copyright notice, and link columns.
OptionTypeDefaultDescription
style'light' | 'dark''light'Color theme of the footer.
logoLogoundefinedFooter logo (same shape as the navbar logo).
copyrightstringundefinedCopyright text shown at the bottom. Supports HTML.
linksColumn[] | FooterLink[][]Link columns (multi-column) or a flat list (simple footer).
docusaurus.config.js
export default {
  themeConfig: {
    footer: {
      style: 'dark',
      copyright: `Copyright © ${new Date().getFullYear()} My Project.`,
      links: [
        {
          title: 'Docs',
          items: [
            {label: 'Getting Started', to: '/docs/intro'},
            {label: 'API Reference', to: '/docs/api'},
          ],
        },
        {
          title: 'Community',
          items: [
            {label: 'Discord', href: 'https://discord.gg/example'},
            {label: 'Twitter', href: 'https://twitter.com/example'},
          ],
        },
      ],
    },
  },
};
Each column item (FooterItem) accepts:
OptionTypeDescription
labelstringLink text.
tostringInternal route.
hrefstringExternal URL. Use to or href, not both.
htmlstringRaw HTML instead of a link (use alone; no label, to, or href).
Pass a flat array of FooterItem objects (no title) to render a single-row link list instead of columns.
docusaurus.config.js
export default {
  themeConfig: {
    footer: {
      links: [
        {label: 'Privacy', href: 'https://example.com/privacy'},
        {label: 'Terms', href: 'https://example.com/terms'},
      ],
    },
  },
};

Prism syntax highlighting

Docusaurus uses Prism React Renderer for code block syntax highlighting. All options live in themeConfig.prism.
OptionTypeDefaultDescription
themePrismThemepalenightPrism theme for light mode code blocks.
darkThemePrismThemepalenightPrism theme for dark mode code blocks.
defaultLanguagestringundefinedLanguage to apply when no language tag is provided on a code fence.
additionalLanguagesstring[][]Extra Prism language definitions to bundle (e.g., ['bash', 'diff', 'php']).
magicCommentsMagicCommentConfig[][highlightLine]Custom magic comment definitions for line-level annotations.
docusaurus.config.js
import {themes as prismThemes} from 'prism-react-renderer';

export default {
  themeConfig: {
    prism: {
      theme: prismThemes.github,
      darkTheme: prismThemes.dracula,
      defaultLanguage: 'javascript',
      additionalLanguages: ['bash', 'diff', 'json', 'php'],
    },
  },
};
You can find the full list of Prism language identifiers at prismjs.com/#supported-languages. Import themes from prism-react-renderer rather than defining them manually.

Table of contents

themeConfig.tableOfContents sets the heading depth range displayed in the TOC shown on the right side of doc pages.
OptionTypeDefaultDescription
minHeadingLevelnumber2Smallest heading level to include. Must be between 2 and 6, and no greater than maxHeadingLevel.
maxHeadingLevelnumber3Largest heading level to include. Must be between 2 and 6.
docusaurus.config.js
export default {
  themeConfig: {
    tableOfContents: {
      minHeadingLevel: 2,
      maxHeadingLevel: 4,
    },
  },
};
You can override the TOC depth per page using the toc_min_heading_level and toc_max_heading_level frontmatter keys on individual MDX files.

Docs plugin options

themeConfig.docs lets you configure UI behavior specific to the docs plugin.
OptionTypeDefaultDescription
versionPersistence'localStorage' | 'none'undefinedWhether the user’s chosen docs version is remembered in localStorage.
sidebar.hideablebooleanfalseAdds a hide/show button at the bottom of the sidebar, allowing users to collapse it.
sidebar.autoCollapseCategoriesbooleanfalseAutomatically collapses sibling categories when you navigate into a new category.
docusaurus.config.js
export default {
  themeConfig: {
    docs: {
      versionPersistence: 'localStorage',
      sidebar: {
        hideable: true,
        autoCollapseCategories: true,
      },
    },
  },
};

Blog plugin options

themeConfig.blog configures the sidebar behavior of the blog plugin’s UI.
OptionTypeDefaultDescription
sidebar.groupByYearbooleantrueWhen true, blog posts in the sidebar are grouped under year headings.
docusaurus.config.js
export default {
  themeConfig: {
    blog: {
      sidebar: {
        groupByYear: false,
      },
    },
  },
};

Announcement bar

The announcement bar is an optional, dismissible panel displayed above the navbar. Configure it using themeConfig.announcementBar.
OptionTypeDefaultDescription
idstring'announcement-bar'Unique identifier used to track dismissal in localStorage. Change the ID to re-show a bar that users have previously closed.
contentstring''HTML content of the announcement.
backgroundColorstring'#fff'Background color of the bar.
textColorstring'#000'Text color inside the bar.
isCloseablebooleantrueWhether to show a dismiss button.
docusaurus.config.js
export default {
  themeConfig: {
    announcementBar: {
      id: 'v3_launch',
      content: 'Docusaurus v3 is now available! <a href="/blog/releases/3.0">Read the blog post</a>.',
      backgroundColor: '#20232a',
      textColor: '#fff',
      isCloseable: true,
    },
  },
};

Global meta image and metadata

Set a default social card image and inject arbitrary <meta> tags site-wide:
OptionTypeDefaultDescription
imagestringundefinedDefault og:image and twitter:image URL. Relative paths resolve to static/. Cannot be an SVG.
metadataMetadata[][]Array of objects passed directly as <meta> tag attributes (name, property, content, etc.).
docusaurus.config.js
export default {
  themeConfig: {
    image: 'img/social-card.png',
    metadata: [
      {name: 'twitter:card', content: 'summary_large_image'},
      {name: 'twitter:site', content: '@myproject'},
    ],
  },
};

i18n: translation files

Theme strings (navbar labels, footer text, etc.) are translated through JSON files located in:
website/i18n/[locale]/docusaurus-theme-classic/
├── navbar.json
└── footer.json
Generate the translation file templates with:
npx docusaurus write-translations --locale fr

Build docs developers (and LLMs) love