Page headers
⋯
The Figma Header Nav and Header Filter components are product page headers. Nesra UI does not
export them. This page shows how to build them from public components. Copy an example and replace
the sample content, actions, and data with your own.
Each example is responsive to its own width through Tailwind container queries (@container), not
the viewport width. A header beside a Sidebar therefore uses the layout that fits the space it has.
Figma Screen |
Figma width | Example container width |
|---|---|---|
Desktop |
1200px | 1024px and wider (@5xl) |
Tab |
769px | 768px to 1023px (@3xl) |
Mobile |
375px | narrower than 768px |
The previews below render each example at the three Figma widths. Wider frames scroll sideways when the page is narrow.
Header Nav with workspace switcher
Section titled “Header Nav with workspace switcher”Figma Header Nav, Variant=BE Marketing. The page title sits on the left. On the right are a
workspace Select, a divider, and three outline icon Buttons. The notification button shows an
unread count. On Mobile, the divider and buttons move into a DropdownMenu behind a More actions
button.
import { Avatar } from "@nesra/ui/avatar";import { Button } from "@nesra/ui/button";import { DropdownMenu } from "@nesra/ui/dropdown-menu";import { Select } from "@nesra/ui/select";import { Bell, EllipsisVertical, PhoneCall, Settings } from "lucide-react";import { useState, type ReactNode } from "react";
const workspaces: Record<string, string> = { acme: "Acme Inc.", globex: "Globex Corporation", initech: "Initech",};
function WorkspaceValue({ value }: { value: string }) { const name = workspaces[value] ?? value; return ( <span className="flex min-w-0 items-center gap-nesra-spacing-md"> <span aria-hidden="true" className="flex shrink-0"> <Avatar initials={name.charAt(0)} name={name} /> </span> <span className="truncate">{name}</span> </span> );}
function HeaderIconButton({ label, icon, count,}: { label: string; icon: ReactNode; count?: number;}) { return ( <Button aria-label={count ? `${label}, ${count} unread` : label} className="relative size-nesra-unit-17! text-nesra-icon-muted" size="icon-md" variant="outline" > {icon} {count ? ( <span aria-hidden="true" className="absolute -top-1 -right-0.5 flex size-3.5 items-center justify-center rounded-full bg-nesra-action-destructive-default type-nesra-body-xsmall-medium text-nesra-text-static-white" > {count} </span> ) : null} </Button> );}
export function HeaderNavWorkspaceExample() { const [workspace, setWorkspace] = useState("acme"); const unread = 2;
return ( <header className="@container w-full border-b border-nesra-stroke-border bg-nesra-foundation-bg-neutral"> <div className="flex h-16 items-center justify-between gap-nesra-spacing-lg px-nesra-padding-2xl @3xl:px-nesra-padding-4xl"> <h1 className="min-w-0 truncate type-nesra-body-small-medium text-nesra-text-headline"> Overview </h1> <div className="flex min-w-0 items-center gap-nesra-spacing-lg"> <Select aria-label="Workspace" className="w-38 @3xl:w-75" onValueChange={(value) => setWorkspace(value ?? "acme")} renderValue={(value) => <WorkspaceValue value={value} />} value={workspace} > {Object.entries(workspaces).map(([value, name]) => ( <Select.Option key={value} value={value}> {name} </Select.Option> ))} </Select> <div className="hidden items-center gap-nesra-spacing-2xl @3xl:flex"> <span aria-hidden="true" className="h-6 w-px bg-nesra-stroke-border-strong" /> <div className="flex items-center gap-nesra-spacing-lg"> <HeaderIconButton icon={<PhoneCall size={20} />} label="Support" /> <HeaderIconButton icon={<Settings size={20} />} label="Settings" /> <HeaderIconButton count={unread} icon={<Bell size={20} />} label="Notifications" /> </div> </div> <DropdownMenu> <DropdownMenu.Trigger render={ <Button aria-label="More actions" className="size-nesra-unit-17! text-nesra-icon-muted @3xl:hidden" size="icon-md" variant="outline" /> } > <EllipsisVertical size={20} /> </DropdownMenu.Trigger> <DropdownMenu.Content align="end"> <DropdownMenu.Item>Support</DropdownMenu.Item> <DropdownMenu.Item>Settings</DropdownMenu.Item> <DropdownMenu.Item>Notifications ({unread} unread)</DropdownMenu.Item> </DropdownMenu.Content> </DropdownMenu> </div> </div> </header> );}Header Nav with search
Section titled “Header Nav with search”Figma Header Nav, Variant=BE Finance. The right side holds a search InputGroup with a ⌘K
hint and a notification button. Command-K or Control-K focuses the search field. The search field
narrows from 340px to 152px on Mobile.
import { Button } from "@nesra/ui/button";import { InputGroup } from "@nesra/ui/input-group";import { Bell, Search } from "lucide-react";import { useEffect, useRef } from "react";
export function HeaderNavSearchExample() { const searchRef = useRef<HTMLInputElement>(null); const unread = 2;
// Command-K or Control-K moves focus to the search field, unless another handler took it. useEffect(() => { function onKeyDown(event: KeyboardEvent) { if (event.defaultPrevented) return; if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k") { event.preventDefault(); searchRef.current?.focus(); } } window.addEventListener("keydown", onKeyDown); return () => window.removeEventListener("keydown", onKeyDown); }, []);
return ( <header className="@container w-full border-b border-nesra-stroke-border bg-nesra-foundation-bg-neutral"> <div className="flex h-16 items-center justify-between gap-nesra-spacing-lg px-nesra-padding-2xl @3xl:px-nesra-padding-4xl"> <h1 className="min-w-0 truncate type-nesra-body-small-medium text-nesra-text-headline"> Overview </h1> <div className="flex min-w-0 items-center gap-nesra-spacing-lg"> <search className="w-38 @3xl:w-85"> <form onSubmit={(event) => event.preventDefault()}> <InputGroup> <InputGroup.Addon aria-hidden="true"> <Search size={16} /> </InputGroup.Addon> <InputGroup.Input aria-keyshortcuts="Meta+K Control+K" aria-label="Search" name="query" placeholder="Search" ref={searchRef} type="search" /> <InputGroup.Addon align="end" aria-hidden="true"> <kbd className="rounded-nesra-xs bg-nesra-surface-card-bg-gray px-nesra-padding-xs type-nesra-body-xsmall-medium text-nesra-text-body"> ⌘ K </kbd> </InputGroup.Addon> </InputGroup> </form> </search> <Button aria-label={`Notifications, ${unread} unread`} className="relative size-nesra-unit-17! shrink-0 text-nesra-icon-muted" size="icon-md" variant="outline" > <Bell size={20} /> <span aria-hidden="true" className="absolute -top-1 -right-0.5 flex size-3.5 items-center justify-center rounded-full bg-nesra-action-destructive-default type-nesra-body-xsmall-medium text-nesra-text-static-white" > {unread} </span> </Button> </div> </div> </header> );}Header Filter
Section titled “Header Filter”Figma Header Filter. Labeled filters sit on the left and the last sync time on the right.
| Screen | Visible filters | In the panel |
|---|---|---|
Desktop |
Date range, Comparison period, Data source | Channel, behind More filters |
Tab |
Date range | Comparison period, Data source, Channel |
Mobile |
none | Every filter, behind Filter |
Date ranges open a Popover with a DatePicker calendar. The panels are Popovers triggered by
Filters.Trigger. All copies of a filter share one state, so a value set in a panel stays set when
the width changes. The application owns the filter values, their defaults, and the data they
query.
import { Button } from "@nesra/ui/button";import { DatePicker, type DateRange } from "@nesra/ui/date-picker";import { Filters } from "@nesra/ui/filters";import { Popover } from "@nesra/ui/popover";import { Select } from "@nesra/ui/select";import { CalendarDays, RefreshCcwDot } from "lucide-react";import { useId, useState, type ReactNode } from "react";
const sources = { all: "All data sources", crm: "CRM", ads: "Ad platforms", web: "Website analytics",};
const channels = { all: "All channels", email: "Email", social: "Social", search: "Search",};
const labelClasses = "type-nesra-body-small-medium text-nesra-text-headline";
function formatDate(value: string) { const [year, month, day] = value.split("-").map(Number); return new Intl.DateTimeFormat("en-US", { month: "short", day: "numeric", year: "numeric", timeZone: "UTC", }).format(new Date(Date.UTC(year!, month! - 1, day)));}
function formatRange(value: DateRange | null) { return value ? `${formatDate(value.start)} – ${formatDate(value.end)}` : "Select dates";}
function DateRangeField({ label, value, onValueChange, className = "",}: { label: string; value: DateRange | null; onValueChange: (value: DateRange | null) => void; className?: string;}) { const [open, setOpen] = useState(false); const labelId = useId();
return ( <div className={`flex-col gap-nesra-padding-xl ${className}`}> <span className={labelClasses} id={labelId}> {label} </span> <Popover open={open} onOpenChange={setOpen}> <Popover.Trigger aria-labelledby={labelId} aria-describedby={`${labelId}-value`} render={ <Button className="h-nesra-unit-17! w-full justify-start @3xl:w-57" startIcon={<CalendarDays />} variant="outline" /> } > <span id={`${labelId}-value`}>{formatRange(value)}</span> </Popover.Trigger> <Popover.Content align="start" className="w-[min(836px,calc(100vw-24px))] p-nesra-padding-xl" > <Popover.Title className="sr-only">{label}</Popover.Title> <DatePicker label={label} mode="range" onValueChange={(next) => { onValueChange(next); setOpen(false); }} presentation="calendar" timeZone="Asia/Jakarta" value={value} /> </Popover.Content> </Popover> </div> );}
// Each screen gets its own panel, so a panel holds only the filters hidden at that width.function FilterPanel({ title, triggerLabel, children,}: { title: string; triggerLabel: string; children: ReactNode;}) { return ( <Popover> <Popover.Trigger render={<Filters.Trigger className="h-nesra-unit-17!" showChevron={false} size="md" />} > {triggerLabel} </Popover.Trigger> <Popover.Content align="start" className="w-[min(320px,calc(100vw-24px))]"> <Popover.Title className="sr-only">{title}</Popover.Title> <div className="flex flex-col gap-nesra-spacing-xl">{children}</div> </Popover.Content> </Popover> );}
export function HeaderFilterExample() { const [period, setPeriod] = useState<DateRange | null>({ start: "2026-07-01", end: "2026-07-30", }); const [comparison, setComparison] = useState<DateRange | null>({ start: "2026-06-01", end: "2026-06-30", }); const [source, setSource] = useState("all"); const [channel, setChannel] = useState("all");
const periodField = (className?: string) => ( <DateRangeField className={className} label="Date range" onValueChange={setPeriod} value={period} /> ); const comparisonField = (className?: string) => ( <DateRangeField className={className} label="Comparison period" onValueChange={setComparison} value={comparison} /> ); const sourceField = (className = "") => ( <div className={className}> <Select items={sources} label="Data source" onValueChange={(value) => setSource(value ?? "all")} value={source} /> </div> ); const channelField = ( <Select items={channels} label="Channel" onValueChange={(value) => setChannel(value ?? "all")} value={channel} /> );
return ( <header className="@container w-full border-b border-nesra-stroke-border bg-nesra-foundation-bg-neutral"> <div className="flex items-center justify-between gap-nesra-spacing-lg px-nesra-padding-2xl py-nesra-padding-xl @3xl:items-end @3xl:px-nesra-padding-4xl"> <div className="flex min-w-0 items-end gap-nesra-spacing-lg"> {periodField("hidden @3xl:flex")} {comparisonField("hidden @5xl:flex")} {sourceField("hidden w-54 @5xl:block")}
{/* Desktop: everything but the extra filters is visible. */} <div className="hidden flex-col gap-nesra-padding-xl @5xl:flex"> <span aria-hidden="true" className={labelClasses}> More filters </span> <FilterPanel title="More filters" triggerLabel="More filters"> {channelField} </FilterPanel> </div>
{/* Tablet: the comparison period and data source move into the panel. */} <div className="hidden flex-col gap-nesra-padding-xl @3xl:flex @5xl:hidden"> <span aria-hidden="true" className={labelClasses}> More filters </span> <FilterPanel title="More filters" triggerLabel="More filters"> {comparisonField("flex")} {sourceField()} {channelField} </FilterPanel> </div>
{/* Mobile: one Filter button holds every filter. */} <div className="@3xl:hidden"> <FilterPanel title="Filters" triggerLabel="Filter"> {periodField("flex")} {comparisonField("flex")} {sourceField()} {channelField} </FilterPanel> </div> </div>
<p className="flex shrink-0 items-center gap-nesra-spacing-md p-nesra-padding-md type-nesra-body-xsmall-regular text-nesra-text-support"> <RefreshCcwDot aria-hidden="true" className="text-nesra-icon-muted" size={16} /> <span> Last sync: <time dateTime="2026-08-11T11:18">Aug 11, 11:18</time> </span> </p> </div> </header> );}Light and Dark
Section titled “Light and Dark”The examples follow the page theme. Dark applies when an ancestor has the dark class or
data-theme="dark". Headers use Foundation/bg-neutral with a Stroke/stroke-border bottom
border. Titles use Text/text-headline. The sync time uses Text/text-support and
Icon/icon-muted. The unread count uses Action/destructive-default with Text/text-static-white
in both modes.
Accessibility
Section titled “Accessibility”- Each title is the page
h1. Keep oneh1per page. - Icon-only buttons have an
aria-label. The unread count is part of the notification button’s name, and the visual count is hidden from assistive technology. - The workspace
Selectis named byaria-label. Its avatar is decorative. - The search field sits in a
formwithrole="search".aria-keyshortcutsannounces the shortcut. The ⌘K hint is decorative. - Each date range trigger is named by its visible label and described by the selected range.
- Changing the workspace, running a search, and applying filters remain the application’s responsibility.
Differences from Figma
Section titled “Differences from Figma”Figma does not define these, so the examples choose a behavior:
- Breakpoints. Figma shows three fixed widths. The examples switch at container widths of 768px and 1024px.
- Mobile actions. Figma shows a More actions button on
Mobile, but not its contents. The example opens aDropdownMenuwith the three hidden actions. - Filter panels. Figma does not show what More filters or Filter open. The examples
open a
Popoverwith the filters hidden at that width, plus a sample Channel filter. - Keyboard shortcut. Figma shows the ⌘K hint but no behavior. The example focuses the search
field on Command-K or Control-K. It skips the key when another handler already called
preventDefault(). On this docs site, the docs search takes ⌘K first. - Hidden breadcrumb. Each Figma header has a hidden
Breadcrumbbeside the title. The examples show only the title. UseBreadcrumbthere when the page needs it.
The examples use package components as they are, so a few details differ from the Figma frames:
- The workspace
Selectis 36px tall with a chevron-down icon. Figma draws a 40px trigger with a shadow and a chevrons-up-down icon. - Icon buttons use the outline
Button, which adds its fill andshadow-xs. Figma’s_Nav buttonhas only a border. Button sizes are 32px or 40px, so the examples setsize-nesra-unit-17!for Figma’s 36px. Date range and filter triggers seth-nesra-unit-17!for the same reason. Filters.Triggerplaces the filter icon before its label. Figma places it after.- Field labels use the
Fieldlabel roleText/text-headlinewith a 12px gap above the control. Figma usesText/text-bodywith an 8px gap. - Both Header Nav examples use 16px side padding on
Mobile. Figma uses 16px forBE Marketingand 24px forBE Finance.
See Navigation Menu Item for horizontal navigation items, and Filters, Select, and Date Picker for the composed parts.