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 |
---|---|
search | string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | ReactPortal | Iterable<ReactNode> | Promise<...> | null |
darkMode | boolean |
docsRepositoryBase | string |
editLink | string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | ReactPortal | Iterable<ReactNode> | Promise<...> | null |
feedback.content | string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | ReactPortal | Iterable<ReactNode> | Promise<...> | null |
feedback.labels | string |
feedback.link | string | undefined |
i18n | { locale: string; name: string; }[] |
lastUpdated | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> |
navigation.next | boolean |
navigation.prev | boolean |
sidebar.defaultMenuCollapseLevel | number |
sidebar.defaultOpen | boolean |
sidebar.toggleButton | boolean |
sidebar.autoCollapse | boolean | undefined |
themeSwitch.dark | string |
themeSwitch.light | string |
themeSwitch.system | string |
toc.float | boolean |
toc.backToTop | string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | ReactPortal | Iterable<ReactNode> | Promise<...> | null |
toc.title | string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | ReactPortal | Iterable<ReactNode> | Promise<...> | null |
toc.extraContent | ReactNode |
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 | number Active index for current page, used for pagination in combination with |
normalizePagesResult.activeThemeContext.pagination | boolean | undefined |
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.sidebar | boolean | undefined |
normalizePagesResult.activeThemeContext.timestamp | boolean | undefined |
normalizePagesResult.activeThemeContext.toc | boolean | undefined |
normalizePagesResult.activeThemeContext.typesetting | "default" | "article" | undefined |
normalizePagesResult.activeMetadata | FrontMatter Parsed 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 | boolean Whether the sidebar is shown. If |