React Sidebar - Flowbite

Use the sidebar component to show a list of menu items including multi-level dropdown menu on the left or right side of your page for admin dashboards and applications

The sidebar component is an UI component that you can use for the navigation mechanism in your website or application that you would position to the left or right side of your page.

A sidebar can include content such as menu list items, dropdown, user profile information, CTA buttons, and more - you can use the custom props from React to customize the options and the utility classes from Tailwind CSS to update the styles.

To start using the sidebar component make sure you import it from the Flowbite React library:

'use client';

import { Sidebar } from 'flowbite-react';

Default sidebar

Use this example to show a list of navigation menu items by adding <Sidebar.Item> children components inside the <Sidebar> component and pass the href prop to set a URL and icon to apply any icons from the react-icons icon library.

You can also add a text label as a badge by using the label prop from React and the labelColor to set the color of the label background.

<Sidebar aria-label="Default sidebar example">
  <Sidebar.Items>
    <Sidebar.ItemGroup>
      <Sidebar.Item
        href="#"
        icon={HiChartPie}
      >
        <p>
          Dashboard
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiViewBoards}
        label="Pro"
        labelColor="dark"
      >
        <p>
          Kanban
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiInbox}
        label="3"
      >
        <p>
          Inbox
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiUser}
      >
        <p>
          Users
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiShoppingBag}
      >
        <p>
          Products
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiArrowSmRight}
      >
        <p>
          Sign In
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiTable}
      >
        <p>
          Sign Up
        </p>
      </Sidebar.Item>
    </Sidebar.ItemGroup>
  </Sidebar.Items>
</Sidebar>

Multi-level dropdown

Use this example to learn how to stack multiple sidebar menu items inside one dropdown menu by using the <Sidebar.Collapse> component.

<Sidebar aria-label="Sidebar with multi-level dropdown example">
  <Sidebar.Items>
    <Sidebar.ItemGroup>
      <Sidebar.Item
        href="#"
        icon={HiChartPie}
      >
        <p>
          Dashboard
        </p>
      </Sidebar.Item>
      <Sidebar.Collapse
        icon={HiShoppingBag}
        label="E-commerce"
      >
        <Sidebar.Item href="#">
          Products
        </Sidebar.Item>
        <Sidebar.Item href="#">
          Sales
        </Sidebar.Item>
        <Sidebar.Item href="#">
          Refunds
        </Sidebar.Item>
        <Sidebar.Item href="#">
          Shipping
        </Sidebar.Item>
      </Sidebar.Collapse>
      <Sidebar.Item
        href="#"
        icon={HiInbox}
      >
        <p>
          Inbox
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiUser}
      >
        <p>
          Users
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiShoppingBag}
      >
        <p>
          Products
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiArrowSmRight}
      >
        <p>
          Sign In
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiTable}
      >
        <p>
          Sign Up
        </p>
      </Sidebar.Item>
    </Sidebar.ItemGroup>
  </Sidebar.Items>
</Sidebar>

Content separator

Use this example to separate content inside of the sidebar using a horizontal line.

<Sidebar aria-label="Sidebar with content separator example">
  <Sidebar.Items>
    <Sidebar.ItemGroup>
      <Sidebar.Item
        href="#"
        icon={HiChartPie}
      >
        <p>
          Dashboard
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiViewBoards}
      >
        <p>
          Kanban
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiInbox}
      >
        <p>
          Inbox
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiUser}
      >
        <p>
          Users
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiShoppingBag}
      >
        <p>
          Products
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiArrowSmRight}
      >
        <p>
          Sign In
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiTable}
      >
        <p>
          Sign Up
        </p>
      </Sidebar.Item>
    </Sidebar.ItemGroup>
    <Sidebar.ItemGroup>
      <Sidebar.Item
        href="#"
        icon={HiChartPie}
      >
        <p>
          Upgrade to Pro
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiViewBoards}
      >
        <p>
          Documentation
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={BiBuoy}
      >
        <p>
          Help
        </p>
      </Sidebar.Item>
    </Sidebar.ItemGroup>
  </Sidebar.Items>
</Sidebar>

This example can be used to show a call to action button inside the sidebar next to the menu items.

<Sidebar aria-label="Sidebar with call to action button example">
  <Sidebar.Items>
    <Sidebar.ItemGroup>
      <Sidebar.Item
        href="#"
        icon={HiChartPie}
      >
        <p>
          Dashboard
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiViewBoards}
      >
        <p>
          Kanban
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiInbox}
      >
        <p>
          Inbox
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiUser}
      >
        <p>
          Users
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiShoppingBag}
      >
        <p>
          Products
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiArrowSmRight}
      >
        <p>
          Sign In
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiTable}
      >
        <p>
          Sign Up
        </p>
      </Sidebar.Item>
    </Sidebar.ItemGroup>
  </Sidebar.Items>
  <Sidebar.CTA>
    <div className="mb-3 flex items-center">
      <Badge color="warning">
        Beta
      </Badge>
      <button
        aria-label="Close"
        className="-m-1.5 ml-auto inline-flex h-6 w-6 rounded-lg bg-cyan-50 p-1 text-cyan-900 hover:bg-cyan-200 focus:ring-2 focus:ring-cyan-400 dark:bg-cyan-900 dark:text-cyan-400 dark:hover:bg-cyan-800"
        type="button"
      >
        <SeeSourceCodeForSVG />
      </button>
    </div>
    <p className="mb-3 text-sm text-cyan-900 dark:text-cyan-400">
      <p>
        Preview the new Flowbite dashboard navigation! You can turn the new navigation off for a limited time in your
        profile.
      </p>
    </p>
    <a
      className="text-sm text-cyan-900 underline hover:text-cyan-800 dark:text-cyan-400 dark:hover:text-cyan-300"
      href="#"
    >
      <p>
        Turn new navigation off
      </p>
    </a>
  </Sidebar.CTA>
</Sidebar>

Feature the branded logo of your company on the top side of the sidebar using this example.

<Sidebar aria-label="Sidebar with logo branding example">
  <Sidebar.Logo
    href="#"
    img="/favicon.svg"
    imgAlt="Flowbite logo"
  >
    <p>
      Flowbite
    </p>
  </Sidebar.Logo>
  <Sidebar.Items>
    <Sidebar.ItemGroup>
      <Sidebar.Item
        href="#"
        icon={HiChartPie}
      >
        <p>
          Dashboard
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiViewBoards}
      >
        <p>
          Kanban
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiInbox}
      >
        <p>
          Inbox
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiUser}
      >
        <p>
          Users
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiShoppingBag}
      >
        <p>
          Products
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiArrowSmRight}
      >
        <p>
          Sign In
        </p>
      </Sidebar.Item>
      <Sidebar.Item
        href="#"
        icon={HiTable}
      >
        <p>
          Sign Up
        </p>
      </Sidebar.Item>
    </Sidebar.ItemGroup>
  </Sidebar.Items>
</Sidebar>

References