Core: Disable single by default on fumadocs-core/toc API

This commit is contained in:
Fuma Nama
2025-10-11 22:39:37 +08:00
parent dd1f079796
commit cbc93e9902
6 changed files with 12 additions and 11 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-core': minor
---
Disable `single` by default on `fumadocs-core/toc` API
+4 -4
View File
@@ -39,7 +39,7 @@ export interface AnchorProviderProps {
/**
* Only accept one active item at most
*
* @defaultValue true
* @defaultValue false
*/
single?: boolean;
children?: ReactNode;
@@ -57,7 +57,7 @@ export interface ScrollProviderProps {
export function ScrollProvider({
containerRef,
children,
}: ScrollProviderProps): React.ReactElement {
}: ScrollProviderProps) {
return (
<ScrollContext.Provider value={containerRef}>
{children}
@@ -67,9 +67,9 @@ export function ScrollProvider({
export function AnchorProvider({
toc,
single = true,
single = false,
children,
}: AnchorProviderProps): React.ReactElement {
}: AnchorProviderProps) {
const headings = useMemo(() => {
return toc.map((item) => item.url.split('#')[1]);
}, [toc]);
+1 -1
View File
@@ -327,7 +327,7 @@ export function DocsLayout({
<LayoutBody
{...props.containerProps}
className={cn(
'md:[&_#nd-page_article]:pt-12 xl:[--fd-toc-width:286px] xl:[&_#nd-page_article]:px-8',
'md:[&_#nd-page_article]:pt-12 xl:[&_#nd-page_article]:px-8',
sidebarEnabled && sidebarVariables,
props.containerProps?.className,
)}
+1 -1
View File
@@ -400,7 +400,7 @@ export function PageTOC(props: ComponentProps<'div'>) {
id="nd-toc"
{...props}
className={cn(
'fixed bottom-0 pt-12 pb-2 pr-(--removed-body-scroll-bar-size,0) max-xl:hidden',
'fixed bottom-0 pt-12 pb-2 pr-(--removed-body-scroll-bar-size,0) xl:on-root:[--fd-toc-width:286px] max-xl:hidden',
props.className,
)}
style={{
+1 -1
View File
@@ -318,7 +318,7 @@ export function DocsLayout(props: DocsLayoutProps) {
<LayoutBody
{...props.containerProps}
className={cn(
'md:[--fd-sidebar-width:286px] xl:[--fd-toc-width:286px]',
'md:[--fd-sidebar-width:286px]',
props.containerProps?.className,
)}
>
-4
View File
@@ -149,10 +149,6 @@ export function DocsPage({
: false
}
{...container}
className={cn(
!tocEnabled && '[--fd-toc-width:0px]',
container?.className,
)}
>
{tocPopoverEnabled &&
(tocPopover ?? (