MobileSidebar

Standalone mobile site navigation sheet for pages with or without a top navbar.

Quick Preview

Usage

Import the sidebar directly when a page needs mobile navigation without rendering TopNavbar.

import { GiddaaLogo } from "@giddaa-housing/ui/logo";
import { MobileSidebar } from "@giddaa-housing/ui/mobile-sidebar";
import { HouseIcon } from "lucide-react";

<MobileSidebar.Root>
	<MobileSidebar.Trigger aria-label="Open main navigation" />
	<MobileSidebar.Content>
		<MobileSidebar.Header>
			<GiddaaLogo className="h-[38px] w-[90px] text-fg-brand" />
			<MobileSidebar.Title>Main navigation</MobileSidebar.Title>
			<MobileSidebar.Close aria-label="Close main navigation" />
		</MobileSidebar.Header>
		<MobileSidebar.Body>
			<MobileSidebar.Nav aria-label="Main navigation">
				<MobileSidebar.List>
					<MobileSidebar.Item>
						<MobileSidebar.Group>
							<MobileSidebar.GroupTrigger icon={<HouseIcon />}>
								Houses
							</MobileSidebar.GroupTrigger>
							<MobileSidebar.GroupPanel>
								<MobileSidebar.SubList>
									<li>
										<MobileSidebar.SubLink href="/houses">
											Browse all homes
										</MobileSidebar.SubLink>
									</li>
								</MobileSidebar.SubList>
							</MobileSidebar.GroupPanel>
						</MobileSidebar.Group>
					</MobileSidebar.Item>
					<MobileSidebar.Item>
						<MobileSidebar.Link href="/agents">Agents</MobileSidebar.Link>
					</MobileSidebar.Item>
				</MobileSidebar.List>
			</MobileSidebar.Nav>
		</MobileSidebar.Body>
	</MobileSidebar.Content>
</MobileSidebar.Root>;

Examples

Without TopNavbar

This example renders MobileSidebar directly, without TopNavbar. Its trigger is visible at every viewport by default, so the consuming page owns where and when it appears. Add a responsive utility class to the trigger when an application only wants it visible at mobile widths.

Props

Prop/APITypeDefaultDescription
MobileSidebar.RootSheet root props-Inherits the surrounding theme scope; wrap it in .light or .dark to pin one (see Theming).
MobileSidebar.TriggerSheet trigger props-Opens the sidebar and provides a menu icon when no children are supplied.
MobileSidebar.Content showCloseButtonbooleanfalseEnables the Sheet floating close control; prefer MobileSidebar.Close in the header for the Figma layout.
MobileSidebar.Content classNamestring-The panel is portalled to document.body; pass light or dark here when the page scopes its theme below <body>.
MobileSidebar.Link iconReactNode-Places an icon in the fixed 20px leading column.
MobileSidebar.Link activebooleanfalseMarks the current page and applies the active surface.
MobileSidebar.GroupBase UI Collapsible root props-Owns controlled or uncontrolled expanded state for a group of sub-items.
MobileSidebar.GroupTrigger iconReactNode-Non-navigating button that toggles its group panel.
MobileSidebar.GroupTrigger activebooleanfalseMarks the group when one of its descendant destinations is current; independent of expanded state.
MobileSidebar.GroupPanelBase UI Collapsible panel props-Animated container for a group’s nested list.
MobileSidebar.Subheadingli props-Labels a nested link group such as Mortgage Houses or Plans.

Accessibility

  • Give MobileSidebar.Trigger and MobileSidebar.Close descriptive labels.
  • Include MobileSidebar.Title even when it remains visually hidden.
  • Use MobileSidebar.Link for destinations and MobileSidebar.GroupTrigger for expandable groups; group titles intentionally do not navigate.
  • Base UI synchronizes aria-expanded, panel visibility, and keyboard activation for each group.
  • Mark only the current destination with active.
  • The underlying Sheet traps focus and closes on Escape or outside press.

On this page