Sourceful Energy

Side Menu

A collapsible sidebar navigation component with sections, tooltips, and icons.

Installation

import { SideMenu } from "@sourceful-energy/ui"

Usage

Examples

Non-collapsible

With Footer

Props

PropTypeDefaultDescription
headerReact.ReactNode-Header content (logo, title, etc.)
collapsedHeaderReact.ReactNode-Header content shown when collapsed (icon, etc.)
sectionsSideMenuSection[][]Navigation sections with collapsible groups
itemsSideMenuItem[][]Standalone items without sections
collapsedboolean-Whether the sidebar is collapsed (controlled)
defaultCollapsedbooleanfalseDefault collapsed state (uncontrolled)
collapsiblebooleantrueWhether the sidebar can be collapsed
onCollapsedChange(collapsed: boolean) => void-Callback when collapsed state changes
activeItemstring-Currently active item id
linkComponentReact.ComponentTypeaCustom link component (e.g., Next.js Link)

Type Definitions

interface SideMenuItem {
  id: string
  label: string
  href?: string
  icon?: React.ReactNode
  badge?: string | number
  onClick?: () => void
  disabled?: boolean
}

interface SideMenuSection {
  id: string
  title: string
  icon?: React.ReactNode
  items: SideMenuItem[]
  defaultExpanded?: boolean
}