AdminKitDocs
Layout

React Bootstrap Sidebar

Add pages to the React Bootstrap sidebar of AdminKit, see how it slides over the page on small screens, and find the navbar and footer around it.

The sidebar holds the menu of your app: a link to every dashboard page, grouped under headers. On large screens it is a column next to the page. On small screens it is a sheet that slides in over the page when you press the toggle in the navbar.

In AdminKit for React, free and PRO, the sidebar is a React component on Bootstrap's markup. You don't write the menu as markup. It is a list of data, so adding a page to it means adding one item.

Pages with "layout": "dashboard" in src/data/pages.json render inside DashboardLayout, in src/layouts/dashboard-layout.tsx. It puts the sidebar, the navbar, the page in <main className="content"> and the footer together:

src/layouts/dashboard-layout.tsx
<LayoutProvider>
  <div className="wrapper">
    <Sidebar />

    <div className="main">
      <Navbar />

      <main className="content reveal-cards">
        <div className="container-fluid p-0">{children}</div>
      </main>

      <Footer />
    </div>
  </div>
</LayoutProvider>

To add a page to the menu, add an item to navigation in src/data/navigation.ts. The list is made of sections, each with a header and its items. Give the new item its title, its route and a Lucide icon from lucide-react:

src/data/navigation.ts
import { ChartNoAxesColumn } from "lucide-react";

export const navigation: NavSection[] = [
  {
    header: "Pages",
    items: [
      // ...
      { title: "Reports", href: "/reports", icon: ChartNoAxesColumn },
    ],
  },
];
FieldTypeDescription
titlestringThe label
hrefstringThe route; the item is active when it is the current route
iconLucideIconThe icon before the label of a top-level item
badge Protrue | stringtrue for the PRO badge, or the text of a light badge
children ProNavItem[]A sub-menu that opens and closes; it opens by itself when one of its items is the current route

The free version's menu has no badges or sub-menus.

Sidebar holds the brand, the menu (SidebarNav) and the call-to-action box at the bottom, in a scroll area made with SimpleBar. In AdminKit PRO it also has the user block with the account menu (SidebarUser). The component is in src/components/sidebar/sidebar.tsx.

How the sidebar shows depends on the width of the screen. From the lg breakpoint (992px) up, it is a column of the layout. Below lg, it is an offcanvas sheet: a panel that slides in over the page. That is the Offcanvas component with responsive="lg". The navbar toggle opens the sheet, and a link, Escape or the backdrop closes it.

The toggle and the sheet have to agree on whether the sheet is open. They share that state through LayoutProvider, in src/contexts/layout-context.tsx. A component can read it with useLayout(), which gives sheetOpen, setSheetOpen, toggleSidebar and expanded. The free version adds collapsed, which is true while the sidebar is hidden.

On large screens the toggle does something else. From lg up, in the free version, it hides and shows the sidebar. In AdminKit PRO it switches between the full sidebar and the compact one, which shows only the icons. The choice is data-sidebar-layout="default" or "compact" on <body>, and it is stored as adminkit_config_sidebarLayout. The head script applies it before the page is painted.

AdminKit PRO can also put the sidebar on the right, with data-sidebar-position="right". The sheet then opens from the right too. See Theming.

Navbar is the top bar. It holds the sidebar toggle, and on the right the notifications, messages, the color mode toggle and the user menu. AdminKit PRO adds a search field, the mega menus, the language menu and a fullscreen button.

Each menu is a component in src/components/navbar/, built on the Dropdown component. The menus come with demo content for you to replace. The bar itself is in src/components/navbar/navbar.tsx. See Navbar for the details.

Footer shows the copyright and a list of links. Change the links in src/components/ui/footer.tsx. The year comes from site.year in src/lib/site.ts.

Last updated on

On this page