This is a navbar. Note that a focused element maintains its state on the route change event. (Layout rendered at: [...])
This is breadcrumbs. Note that it is not a "god" component. Data loading is decoupled by the use of hooks inside the page layout. (Breadcrumbs rendered at: [...])
This is a sidebar. (Rendered at: [...])

The page with a sidebar

Here is used the layout with sidebar.


export default pageComponentWithLayout(
  function Page() { /* ... */ },
  function PageLayout({ PageComponent, pageProps }) {
    // Data loading simulation
    const [pathParts, setPathParts] = useState<
      { title: string; path: string }[]
    >([]);
    const [paths, setPaths] = useState<{ title: string; path: string }[]>([]);
    useEffect(() => {
      setTimeout(() => {
        setPathParts([
          { title: "Main", path: "/" },
          { title: "Page with a sidebar", path: "/sidebar" },
        ]);
      }, 800);
    }, []);
    useEffect(() => {
      setTimeout(() => {
        setPaths([
          { title: "Page with a sidebar", path: "/sidebar" },
          {
            title: "Nested page with a fullscreen layout",
            path: "/sidebar/fullscreen",
          },
        ]);
      }, 1200);
    }, []);

    return (
      <Layout key="layout">
        <Navbar key="navbar" />
        <Breadcrumbs key="breadcrumbs" pathParts={pathParts} />
        <Sidebar key="sidebar" paths={paths}>
          <PageComponent {...pageProps} />
        </Sidebar>
      </Layout>
    );
  }
);
          

Check the nested page: Page with a fullscreen layout

This is a demo of the "@kvet/next-layout" package. Note that the layout component maintains its state on the route change event. (The layout rendered at: [...])