npm / nextra
nextra
What changed in nextra 3 to 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-23.
101 breaking37 new APIs and options2 performance13 behavior and defaults2 tooling1 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initnextra 4101 changes
Breaking changes 62
Nextra 4 exclusively uses the Next.js App Router; Pages Router support has been discontinued.
Nextra 4 uses Next.js App Router and discontinues Pages Router support.
collectCatchAllRoutes is removed.
The color-primary-750 theme color variant is removed.
compileMdx now returns Promise<string> instead of Promise<object>.
contentDirBasePath replaces useContentDir and configures the content directory under a catch-all subdirectory.
convertPageMapToJs is now synchronous.
createCatchAllMeta is removed from nextra/catch-all.
Use
display: 'hidden'in a blog_metafile instead of thedraft: truefront matter option.External links in MDX now open in a new tab with rel="noreferrer" and a visual ↗ suffix icon.
getPageMap now accepts one optional root argument instead of lang and route arguments.
The Head component moves to nextra/components.
mdx-components replaces nextraConfig.mdxOptions.providerImportSource for adding or overriding code-block icons.
The server component is named
<MDXRemote>; it was previously called<RemoteContent>.Use MDXRemote from nextra/mdx-remote; its default components are provided automatically from mdx-components.jsx.
These files must be server components without a
'use client'directive; zod parses and transforms them on the server.External links declared in
_metafiles open in a new tab, userel="noreferrer", and display a↗suffix icon.Front matter fields are exported as an MDX
metadataobject; MDX files may instead exportmetadatadirectly, but cannot use both approaches.TypeScript projects should set moduleResolution to bundler instead of node to avoid type errors.
The
_metanewWindowfield was removed.Use the Next.js Metadata API instead of the
headtheme config option for dynamic head tags.Nextra 4 requires Next.js 14 or later.
Several components, including
<Collapse>,<Details>,<Summary>,<Select>, and<Head>, moved fromnextra-theme-docstonextra/componentsfor use in custom themes.Components including Collapse, Details, Summary, SkipNavContent, SkipNavLink, Select, and Bleed move from nextra-theme-docs to nextra/components.
The nextra/context entry point is removed.
The nextra/mdx entry point is renamed to nextra/mdx-components.
The nextra/remark-plugins entry point is removed.
The nextra/remote entry point is removed.
The nextra/schemas entry point is removed.
NextraConfig.transformPageMap is removed.
The NextraThemeLayoutProps type is removed.
normalizePageRoute is removed.
Search migrated from FlexSearch to Pagefind, which indexes remote MDX, dynamic Markdown/MDX content, imported files, and static pages.
Install Pagefind as a dev dependency and run it after building to index generated HTML pages.
Remote docs setups need a modified pageMap list in the layout file for sidebar navigation links to display correctly.
The optional peer dependency was removed; the theme uses the Cusdis SDK directly in its
<Comments>component.RemoteContent was renamed to MDXRemote and moved from nextra/components to nextra/mdx-remote.
renderComponent is removed.
renderString is removed.
Sidebar titles now fall back to the first Markdown h1 heading after checking _meta, sidebarTitle, and title front matter.
Theme stylesheets are no longer imported by themes; import the appropriate theme style.css manually.
Th, Tr, and Td are now accessed as Table.Th, Table.Tr, and Table.Td instead of separate imports.
The standalone Td export was removed; use Table.Td.
The standalone Th export was removed; use Table.Th.
The
themeoption was removed from Nextra configuration.The
theme.bottomContentfield was removed.Nextra 4 no longer supports theme.config files for configuring theme options.
The
componentstheme config option was removed; provide custom components insideuseMDXComponentsinstead.The
directiontheme config option was removed; set thedirattribute on the<html>tag.The
feedback.useLinktheme config option was removed.The
headtheme config option was removed; use<Head>or the Next.js Metadata API.The
maintheme config option was removed.The
themeSwitch.componenttheme config option was removed.The
toc.componenttheme config option was removed.The
theme.layout: 'raw'option was removed; usepage.{jsx,tsx}files to create pages without a layout.The
theme.topContentfield was removed.The
themeConfigoption was removed from Nextra configuration.Generated MDX pages no longer export const title.
The exported TOC value is now toc instead of useTOC.
The standalone Tr export was removed; use Table.Tr.
Nextra’s useRouter hook was removed; use useRouter from next/navigation instead.
The theme’s Tailwind CSS class prefix changed from
_tox:; update overridden theme classes accordingly.
New APIs and options 27
Nextra 4 supports the App Router.
Set asIndexPage: true in front matter to make a page serve as the index for its folder.
Set the path from which content is served when using the Content Directory Convention.
Create a rendered listing of a route’s subpages, using getPageMap to supply the page map.
Mark the main content area of JavaScript or TypeScript pages to have its content indexed by Pagefind.
Add this attribute to tags whose content should be excluded from Pagefind indexing.
Get a route’s page map for use with createIndexPage to list its subpages.
The docs and blog themes support rendering GitHub alert syntax in Markdown and MDX as Callout components.
Set the optional icon front matter field on a subpage to show an icon on its card.
Add an app layout file to configure the Nextra layout, theme components, metadata, and page map.
Create this root-level file to define global MDX components.
mergeMetaWithPageMap is added to nextra/page-map.
Define pages across folders in one suffixed
_metafile; folder items must include anitemsfield.A root _meta.global file is added; supported extensions include js, jsx, ts, and tsx.
Nextra 4 introduces the _meta.global file.
Add
--turbopackto the dev command to use Nextra with Turbopack.The blog theme adds support for the View Transitions API using this package.
normalizePagesResult gains activeMetadata to retrieve front matter or metadata exported from a page.
The Page File Convention uses the Next.js App Router convention with enhanced page extensions for MD and MDX files.
A Rust-powered search engine provides faster performance and better search results.
The Search component is exported from
nextra/componentsfor use in custom themes; the blog theme also supports search.The blog theme supports built-in search; import
<Search>fromnextra/componentsand place it inside<Navbar>.Nextra 4 adds support for Server/Client components.
Translations can be dynamically loaded in server components and passed as props to theme components, avoiding shipping client translation dictionary files.
Whitelist HTML elements to be replaced with components from
mdx-components.js; by default only<details>and<summary>are replaced.Wrap the Pre component with custom icons for specified code languages.
Wrapper gains a bottomContent prop for placing content after pagination in nextra-theme-docs.
Performance 2
The Docs Example's shared First Load JS decreased by 36.9%, from 168 kB to 106 kB.
Imports from nextra/components, nextra-theme-docs, and nextra-theme-blog are optimized internally with Next.js optimizePackageImports to improve bundle size.
Behavior and default changes 7
JSX and TSX code blocks now display the React icon; diff blocks with a filename use the icon for that file extension.
The built-in 404 page includes an issue-creation URL with the referrer URL to help identify broken links.
Page collection now includes static jsx and tsx pages from the app directory, as well as static md and mdx pages.
Built-in internationalization capabilities now support React Server Components.
The primary color variant set through the Head component’s color prop is now used for text selection styles.
The table of contents can show React components, interpolated variables, and LaTeX, including for remote content.
Headings now animate when in the
:targetstate.
Tooling 2
Nextra 4 is compiled by React-Compiler.
Nextra 4 adds Turbopack support for an improved development experience.
Fixes and other changes 1
Fixes compatibility with Next.js 16.
nextra 355 changes
Breaking changes 39
The
_app.mdxconvention is removed; use_app.{js,jsx}or_app.{ts,tsx}for TypeScript projects instead.The standalone
Cardexport is removed; useCards.Cardinstead.The
imageprop is removed; image display is determined by the truthiness ofchildren.The minimum supported Node.js version is 18.
Nextra bundles to ESM only; use
next.config.mjsornext.config.jswithtype: module.Support for
frontMatter.mdxOptionsis removed.layout.tsxis removed; move directly tosetup-page.tsx.defaultLocaleis removed fromLoaderOptions.Importing MD or MDX files outside the working directory is disallowed; use symlinks instead.
Nextra updates to MDX3.
Support for
_meta.jsonis removed; use_meta.{js,jsx,ts,tsx}instead.The package declares
type: moduleand is bundled to ESM only; usenext.config.mjsornext.config.jswithtype: module.The
nextra/filter-route-localeexport is removed.The route-specific
themeConfiginternal context field is removed.The Nextra middleware export is removed.
The
nextra/mdx-pluginsexport is removed;nextra/remark-pluginsis added.resolvePageMapmoves tonextra/page-map-dynamic.Adds the
nextra/remove-linksexport.The
nextraConfig.flexsearchoption is renamed tonextraConfig.search.The
hotpage option is removed.The
pageNextRoutepage option is removed.The
pageOptsChecksumpage option is removed.localeanddefaultLocaleare removed fromnormalizePages.The Tailwind prefix changes from
nx-to_to reduce bundle size.pageMapCacheis removed fromnextra/page-map.pageOpts.headingsis renamed totoc.The
pageOpts.newNextLinkBehaviorfield is removed.The
pageOpts.routefield is removed.Remove
PageOpts.toc; use thetocprop fromcomponents.wrapper.parseFileNameis removed fromnextra/utils.The Next.js peer dependency requirement is set to
>=13.React 18 becomes the minimum requirement.
RemoteContentmoves fromnextra/datatonextra/components.resolvePageMapis removed fromnextra/page-map.Nextra switches to
shikijiinstead ofshikifor syntax highlighting.The standalone
Tabexport is removed; useTabs.Tabinstead.The Nextra option
transformPageOptsis replaced bytransformPageMap.useDatamoves fromnextra/datatonextra/hooks.useSSGis renamed touseData.
New APIs and options 10
Adds a Nextra configuration option to import official theme CSS into a specific cascade layer.
Front matter can set the page label shown in the sidebar.
Adds MathJax support.
Adds support for JavaScript and TypeScript
_metafiles, including JSX.Adds the
nextra/fetch-filepaths-from-githubexport.Adds
useRouterfor fetchinglocaleanddefaultLocale.recmaPluginscan be passed inmdxOptions.Adds
remark-smartypantssupport.Adds shikiji twoslash support.
Code block metadata can set
word-wrap=falseto disallow the mobile word-wrap button.
Behavior and default changes 6
The
iconprop becomes optional.Front matter is inserted as an export node via a custom remark plugin.
Nextra configuration gains Zod validation.
Repeated imports of the same image are deduplicated, and images can be imported through Markdown image definitions.
classNameuses render props withselected,disabled, andhoverstate.The
Tabcomponent is crawlable and indexable by search engines by default.