diff --git a/packages/layout/src/LayoutChildren.tsx b/packages/layout/src/LayoutChildren.tsx index 0a5278a4a7..70d34c8a10 100644 --- a/packages/layout/src/LayoutChildren.tsx +++ b/packages/layout/src/LayoutChildren.tsx @@ -1,4 +1,10 @@ -import React, { ReactElement, ReactNode, useEffect, useState } from "react"; +import React, { + HTMLAttributes, + ReactElement, + ReactNode, + useEffect, + useState, +} from "react"; import { SkipToMainContent, SkipToMainContentProps } from "@react-md/link"; import { BaseTreeItem, TreeData } from "@react-md/tree"; import { PropsWithRef } from "@react-md/utils"; @@ -8,6 +14,7 @@ import { LayoutAppBar } from "./LayoutAppBar"; import { LayoutMain, LayoutMainProps } from "./LayoutMain"; import { LayoutNavigation } from "./LayoutNavigation"; import { useLayoutConfig } from "./LayoutProvider"; +import { MiniLayoutWrapper } from "./MiniLayoutWrapper"; import { LayoutNavigationItem } from "./types"; import { isMiniLayout } from "./utils"; @@ -60,6 +67,23 @@ export interface LayoutChildrenProps< */ miniNavItems?: TreeData; + /** + * This prop allows you to provide additional props to the `
` surrounding + * the `LayoutMain` and mini `LayoutNavigation` components. + * + * Note: This additional `
` will only be rendered if: + * - the current layout is one of the `mini` types + * - the layout is not using a fixed app bar + * - the `miniNav` prop has not been defined + * - `treeProps` have been provided + * + * @remarks \@since 2.8.3 + */ + miniWrapperProps?: PropsWithRef< + HTMLAttributes, + HTMLDivElement + >; + /** * The children to display within the layout. This is pretty much required * since you'll have an empty app otherwise, but it's left as optional just @@ -88,8 +112,9 @@ export function LayoutChildren({ navToggleProps, navAfterAppBar = false, nav: propNav, - miniNav: propMiniNav, + miniNav, miniNavItems, + miniWrapperProps, navHeader, navHeaderProps, navHeaderTitle, @@ -152,48 +177,38 @@ export function LayoutChildren({ ); } - let miniNav = propMiniNav; - if (mini && treeProps && typeof miniNav === "undefined") { - let miniTreeProps = treeProps; - if (miniNavItems) { - miniTreeProps = { - ...miniTreeProps, - navItems: miniNavItems, - }; - } - - miniNav = ( -