Fusion UI LogoFusion UI Logo
Fusion UI LogoFusion UI Logo
/
Getting Started
Concepts
Components
Example Apps
Getting Started
Concepts
Components
Example Apps
Fusion UI LogoFusion UI Logo
Getting Started
Concepts
Components
Example Apps
Overview
Actions
Button
Button Group
Segmented Button
Deprecated
Split Button
Toggle Button
Click To Copy
Toolbar
Navigation
Main Nav
Side Menu
Page Header
Tabs
Breadcrumbs
On-Page Menu
Link
Command Menu
Application Switcher
Context Switcher
Account Menu
Menu Bar
Deprecated
Inputs & Forms
Form
Form Actions
Deprecated
Form Divider
Form Field
Form Repeat
Form Spacing
Input
Prefix & Suffix
Rich Text Input
Autocomplete
Select
Date / Time Input
Calendar
Slider
Selection
Checkbox
Radio
Switch
Switch Select
Chip
Chip Choice
Chip Filter
Chip Input
Chip Sortable
Visual Select
Pricing Plan Select
Feedback & Loading
Banner
Inline Message
Snackbar
Inline Snackbar
Loading Spinner
Skeleton
Text Skeleton
Contextual Information
Badge
Status
Tag
Tooltip
Info
Hotkey
Icon
Icon Sizer
Containers & Overlays
Tile
Tile Content
Tile Footer
Tile Header
Annotated Section
Modal
Sheet
Popover
Context Menu
Data Display
Data Table
List
Timeline
Data Visualization
KPI Card
Ratio Card
Bar Chart
Line Chart
Pie Chart
Heatmap Calendar
Layout
Container
Stack Layout
Flow Layout
Internals
Blanket
Expansion Panel
Menu List Base
Menu Group
Search Bar
Components
...
Side Menu

Side Menu

Vertical navigation for the sections of an area, collapsible on small screens.

Overview

SideMenuView places a vertical menu at the left edge and the page next to it. Sections with an optional title group the items, items can have an icon and children that expand below them. The component pages of this documentation use it.

The side menu is never used on its own, only in addition to a MainNavView: the main nav switches between the areas of the application, the side menu lists the pages of the current area.

/preview/side-menu

File: side-menu-demo.tsx

"use client";
import React from "react";
import {
Container,
IconDashboard,
IconFileList,
IconSettings3,
IconTeam,
MainNavView,
PageHeaderView,
SideMenuFooter,
SideMenuItem,
SideMenuSection,
SideMenuView,
StackLayout,
Tile,
TileContent,
TileHeader,
} from "@brynlabs/fusion-ui";
// The side menu lists the pages of one area, the main nav around it switches between the areas
export const SideMenuDemo = () => (
<MainNavView
logo={<span className={"heading-4-font"}>Acme</span>}
menuItems={[
{title: "Analytics", href: "/preview/side-menu"},
{title: "Projects", href: "#projects"},
{title: "Billing", href: "#billing"},
]}>
<SideMenuView
menuItems={
<>
<SideMenuSection>
<SideMenuItem
menuItem={{title: "Dashboard", href: "/preview/side-menu", icon: <IconDashboard />}}
/>
<SideMenuItem
menuItem={{
title: "Reports",
href: "#reports",
icon: <IconFileList />,
children: [
{title: "Revenue", href: "#revenue"},
{title: "Customers", href: "#customers"},
],
}}
/>
</SideMenuSection>
<SideMenuSection sectionTitle={"Organization"}>
<SideMenuItem menuItem={{title: "Team", href: "#team", icon: <IconTeam />}} />
<SideMenuItem
menuItem={{title: "Settings", href: "#settings", icon: <IconSettings3 />}}
/>
</SideMenuSection>
</>
}
footer={
<SideMenuFooter>
<span className={"small-font"}>Version 2.4.0</span>
</SideMenuFooter>
}>
<PageHeaderView pageHeaderTitle={"Dashboard"}>
<Container direction={"both"}>
<StackLayout>
<Tile>
<TileHeader>Side Menu</TileHeader>
<TileContent>
The side menu lists the pages of this area. Sections group related pages, items can
have icons and children. Make the window narrow to see how it collapses.
</TileContent>
</Tile>
</StackLayout>
</Container>
</PageHeaderView>
</SideMenuView>
</MainNavView>
);

Menu items

menuItems takes either components or a configuration. Pass a list of MenuItems, or a Menu, a list of sections with an optional title and their items, as the MainNavView does for its items. Use components (SideMenuSection, SideMenuItem) when you need control over a single item, e.g. its badge.

const menu: Menu = [
{items: [{title: "Dashboard", href: "/dashboard", icon: <IconDashboard />}]},
{
title: "Organization",
items: [
{title: "Team", href: "/team", icon: <IconTeam />},
{
title: "Settings",
href: "/settings",
children: [{title: "Billing", href: "/settings/billing"}],
},
],
},
];
<SideMenuView menuItems={menu}>{page}</SideMenuView>

Inside the main nav

Always render it inside the MainNavView. There the side menu is integrated into its hierarchy: on phones it is hidden and opens with the menu button of the main nav, which also leads back up to the main menu.

<MainNavView menuItems={areas}>
<SideMenuView
menuItems={
<SideMenuSection sectionTitle={"Reports"}>
{reports.map(item => (
<SideMenuItem key={item.href} menuItem={item} />
))}
</SideMenuSection>
}>
<PageHeaderView pageHeaderTitle={"Revenue"}>{page}</PageHeaderView>
</SideMenuView>
</MainNavView>
On this page
  • Overview
  • Menu items
  • Inside the main nav