API
useThemeConfig hook
The useThemeConfig hook returns values of your
theme configuration and is made to
dynamically configure your project.
import { useThemeConfig } from 'nextra-theme-docs'A subset of your theme configuration context.
| Name | Type |
|---|---|
darkMode | boolean |
docsRepositoryBase | string |
editLink | string | number | bigint | boolean | ReactPortal | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<...> | null |
feedback.link | string | undefined |
feedback.content | string | number | bigint | boolean | ReactPortal | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<...> | null |
feedback.labels | string |
i18n | { locale: string; name: string; }[] |
lastUpdated | ReactElement<unknown, string | JSXElementConstructor<any>> |
navigation | boolean | { next: boolean; prev: boolean; } |
search | string | number | bigint | boolean | ReactPortal | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<...> | null |
sidebar.autoCollapse | boolean | undefined |
sidebar.defaultMenuCollapseLevel | number |
sidebar.defaultOpen | boolean |
sidebar.toggleButton | boolean |
themeSwitch.dark | string |
themeSwitch.light | string |
themeSwitch.system | string |
toc.extraContent | ReactNode |
toc.backToTop | string | number | bigint | boolean | ReactPortal | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<...> | null |
toc.float | boolean |
toc.title | string | number | bigint | boolean | ReactPortal | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<...> | null |
useConfig hook
import { useConfig } from 'nextra-theme-docs'The useConfig hook returns data from your current page context.
An object containing the normalizePagesResult and a hideSidebar value.
| Name | Type |
|---|---|
normalizePagesResult.activeType | "doc" | "page" | "menu"Active type for current page, used to determine layout in theme. |
normalizePagesResult.activeIndex | numberActive index for current page, used for pagination in combination with |
normalizePagesResult.activeThemeContext.breadcrumb | boolean | undefined |
normalizePagesResult.activeThemeContext.collapsed | boolean | undefined |
normalizePagesResult.activeThemeContext.footer | boolean | undefined |
normalizePagesResult.activeThemeContext.layout | "default" | "full" | undefined |
normalizePagesResult.activeThemeContext.navbar | boolean | undefined |
normalizePagesResult.activeThemeContext.pagination | boolean | undefined |
normalizePagesResult.activeThemeContext.sidebar | boolean | undefined |
normalizePagesResult.activeThemeContext.timestamp | boolean | undefined |
normalizePagesResult.activeThemeContext.toc | boolean | undefined |
normalizePagesResult.activeThemeContext.typesetting | "default" | "article" | undefined |
normalizePagesResult.activeMetadata | FrontMatterParsed front matter or exported Metadata from page. |
normalizePagesResult.activePath | Item[]Active path for current page, used for breadcrumb navigation. |
normalizePagesResult.directories | Item[]All directories in the tree structure. |
normalizePagesResult.docsDirectories | DocsItem[]Directories with |
normalizePagesResult.flatDocsDirectories | DocsItem[]Flattened directories with |
normalizePagesResult.topLevelNavbarItems | (PageItem | MenuItem)[]Navbar items, items which have |
hideSidebar | booleanWhether the sidebar is shown. If |