diff --git a/packages/fumadocs/src/docs-layout.test.ts b/packages/fumadocs/src/docs-layout.test.ts
index 37757405..7a38e6f8 100644
--- a/packages/fumadocs/src/docs-layout.test.ts
+++ b/packages/fumadocs/src/docs-layout.test.ts
@@ -100,6 +100,23 @@ describe("createDocsLayout pageActions", () => {
expect(props?.pageActionsPosition).toBe("below-title");
});
+ it("does not add an extra display: contents wrapper above the docs layout root", () => {
+ const Layout = createDocsLayout({
+ entry: "docs",
+ });
+
+ const tree = Layout({
+ children: React.createElement("div", null, "child"),
+ });
+
+ expect(React.isValidElement(tree)).toBe(true);
+ expect(tree.type).not.toBe("div");
+ expect((tree.props as { id?: string; style?: { display?: string } }).id).toBeUndefined();
+ expect(
+ (tree.props as { id?: string; style?: { display?: string } }).style?.display,
+ ).toBeUndefined();
+ });
+
it("supports boolean shorthand, custom providers, and above-title placement", () => {
const Layout = createDocsLayout({
entry: "docs",
diff --git a/packages/fumadocs/src/docs-layout.tsx b/packages/fumadocs/src/docs-layout.tsx
index 7859ef3d..f6fed594 100644
--- a/packages/fumadocs/src/docs-layout.tsx
+++ b/packages/fumadocs/src/docs-layout.tsx
@@ -955,81 +955,79 @@ export function createDocsLayout(config: DocsConfig, options?: { locale?: string
}
return (
-
- } },
- }
- : {})}
- >
-
-
-
- {forcedTheme && }
- {!staticExport && (
-
-
-
- )}
- {aiEnabled && (
-
-
-
- )}
-
- } },
+ }
+ : {})}
+ >
+
+
+
+ {forcedTheme && }
+ {!staticExport && (
+
+
+
+ )}
+ {aiEnabled && (
+
+
- {children}
-
+ position={aiPosition}
+ floatingStyle={aiFloatingStyle}
+ triggerComponentHtml={aiTriggerComponentHtml}
+ suggestedQuestions={aiSuggestedQuestions}
+ aiLabel={aiLabel}
+ loaderVariant={aiLoaderVariant}
+ loadingComponentHtml={aiLoadingComponentHtml}
+ models={aiModels}
+ defaultModelId={aiDefaultModelId}
+ />
-
-
+ )}
+
+
+ {children}
+
+
+
);
};
}
diff --git a/packages/fumadocs/src/tanstack-layout.test.ts b/packages/fumadocs/src/tanstack-layout.test.ts
new file mode 100644
index 00000000..bcd0cf0e
--- /dev/null
+++ b/packages/fumadocs/src/tanstack-layout.test.ts
@@ -0,0 +1,25 @@
+import React from "react";
+import { describe, expect, it } from "vitest";
+import { TanstackDocsLayout } from "./tanstack-layout.js";
+
+describe("TanstackDocsLayout", () => {
+ it("does not add an extra display: contents wrapper above the docs layout root", () => {
+ const tree = TanstackDocsLayout({
+ config: {
+ entry: "docs",
+ },
+ tree: {
+ name: "Docs",
+ children: [],
+ },
+ children: React.createElement("div", null, "child"),
+ });
+
+ expect(React.isValidElement(tree)).toBe(true);
+ expect(tree.type).not.toBe("div");
+ expect((tree.props as { id?: string; style?: { display?: string } }).id).toBeUndefined();
+ expect(
+ (tree.props as { id?: string; style?: { display?: string } }).style?.display,
+ ).toBeUndefined();
+ });
+});
diff --git a/packages/fumadocs/src/tanstack-layout.tsx b/packages/fumadocs/src/tanstack-layout.tsx
index c7da312b..f609af61 100644
--- a/packages/fumadocs/src/tanstack-layout.tsx
+++ b/packages/fumadocs/src/tanstack-layout.tsx
@@ -440,74 +440,72 @@ export function TanstackDocsLayout({
}
return (
-
- } },
- }
- : {})}
- >
-
-
-
- {forcedTheme && }
- {!staticExport && (
-
-
-
- )}
- {aiEnabled && (
-
-
-
- )}
-
- } },
+ }
+ : {})}
+ >
+
+
+
+ {forcedTheme && }
+ {!staticExport && (
+
+
+
+ )}
+ {aiEnabled && (
+
+
- {children}
-
+ position={aiPosition}
+ floatingStyle={aiFloatingStyle}
+ suggestedQuestions={aiSuggestedQuestions}
+ aiLabel={aiLabel}
+ loaderVariant={aiLoaderVariant}
+ models={aiModels}
+ defaultModelId={aiDefaultModelId}
+ />
-
-
+ )}
+
+
+ {children}
+
+
+
);
}