Blossom UI

Sidebar

Sidebar component with groups, nested items, badges, links and a collapsed mode with tooltips.

How to use it

Run npx @blossomui/react add sidebar, or copy src/components/UI/Sidebar/Sidebar.tsx into your React project and import it.

import { Sidebar } from './components/ui/Sidebar'

Props

SidebarItem

PropTypeDescription
id (required)string
label (required)string
iconReactNodeIcon of the item. It is the only thing shown when the sidebar is collapsed, so give every item one.
hrefstringMakes the item a link. Without it the item is a button that calls `onSelect`.
badgeReactNodeSmall text on the right, for example a counter.
childrenSidebarItem[]Sub items. The item opens and closes them instead of being chosen.
disabledboolean
onSelect() => void

SidebarSection

PropTypeDescription
titlestringTitle of the group, shown over its items.
items (required)SidebarItem[]

SidebarLabels

PropTypeDescription
collapse (required)stringAccessible name of the button that collapses the sidebar.
expand (required)stringAccessible name of the button that expands the sidebar.

SidebarProps

PropTypeDescription
labelsPartial<SidebarLabels>Texts of the component. Pass only the ones you want to change, for example to translate it.
sections (required)SidebarSection[]
activeIdstringId of the item that is the current page.
onNavigate(id: string) => voidCalled with the id of the item the user chose.
headerReactNode | ((collapsed: boolean) => ReactNode)Content at the top, for example the logo.
footerReactNode | ((collapsed: boolean) => ReactNode)Content at the bottom, for example the user.
collapsedbooleanControlled collapsed state. Use together with `onCollapsedChange`.
defaultCollapsedboolean
onCollapsedChange(collapsed: boolean) => void
collapsiblebooleanShow the button that collapses the sidebar to icons.
colorstringAccent color of the active item: any CSS color. Without it the component uses `--blossom-accent`.
labelstringAccessible name of the navigation.
classNamestringGive it a height, for example `h-[32rem]`.

Getting started

  • Introduction
  • Installation
  • Changelog

Customization

  • Colors
  • Brand color
  • Texts and translation

Components

  • Accordion
  • Alert dialog
  • Alerts
  • Avatar
  • Badges
  • Banner
  • Breadcrumb
  • Buttons
  • Calendar
  • Cards
  • Carousel
  • Charts
  • Chip input
  • Collapsible
  • Color picker
  • Combobox
  • Command palette
  • Context menu
  • Copy button
  • Date picker
  • Drawer
  • Dropdown
  • Empty state
  • File upload
  • Footer
  • Forms
  • Hover card
  • Jumbotron
  • KBD
  • Menubar
  • Modal
  • Navbar
  • Navigation menu
  • Number input
  • OTP input
  • Pagination
  • Popover
  • Pricing
  • Progress
  • Rating
  • Resizable panels
  • Scroll area
  • Segmented control
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Spinners
  • Stats
  • Stepper
  • Survey
  • Table
  • Tabs
  • Time picker
  • Timeline
  • Timer button
  • Toasts
  • Tooltip
  • Transfer list
  • Tree