Header Bar
The header bar provides a consistent, high-level control surface for the application. It features a logo that reinforces brand identity, navigation items for accessing primary sections, and an action bar that contains important tools and utilities.
import {HeaderBar} from "@qualcomm-ui/react/header-bar"Examples
Responsive Design
These examples use Tailwind container queries for mobile-first responsiveness. Tailwind is installed on our documentation sites only, and is not required to use any of our components.
Basic Usage
A typical header bar includes a logo, application title, nav items, and an action bar.
import type {ReactElement} from "react"
import {Layers2, LayoutGrid, Moon, Settings} from "lucide-react"
import {Avatar} from "@qualcomm-ui/react/avatar"
import {HeaderBar} from "@qualcomm-ui/react/header-bar"
import {Icon} from "@qualcomm-ui/react/icon"
export function HeaderBarShowcaseDemo(): ReactElement {
return (
<HeaderBar.Root className="@container">
<HeaderBar.Logo>
<div className="bg-category-1-subtle rounded-sm p-0.5">
<Icon icon={Layers2} size="lg" />
</div>
<HeaderBar.AppTitle>Qualcomm AI Visualizer</HeaderBar.AppTitle>
</HeaderBar.Logo>
<HeaderBar.Divider />
<HeaderBar.Nav className="hidden @min-[580px]:flex">
<HeaderBar.NavItem>Home</HeaderBar.NavItem>
<HeaderBar.NavItem>
<Icon icon={Settings} />
Settings
</HeaderBar.NavItem>
</HeaderBar.Nav>
<HeaderBar.ActionBar className="hidden @min-[285px]:flex">
<HeaderBar.ActionIconButton icon={Moon} />
<HeaderBar.ActionIconButton icon={Settings} />
<HeaderBar.ActionButton
className="hidden @min-[450px]:inline-flex"
startIcon={LayoutGrid}
>
Apps
</HeaderBar.ActionButton>
<HeaderBar.Divider className="hidden @min-[375px]:block" />
<Avatar.Root
className="hidden @min-[375px]:flex"
size="xs"
variant="contrast"
>
<Avatar.Content>JD</Avatar.Content>
</Avatar.Root>
</HeaderBar.ActionBar>
</HeaderBar.Root>
)
}Sizes
The header bar has two sizes: sm (default) and lg. The size prop governs padding, element spacing, and height.
import type {ReactElement} from "react"
import {Layers2, LayoutGrid, Moon, Settings} from "lucide-react"
import {Avatar} from "@qualcomm-ui/react/avatar"
import {HeaderBar} from "@qualcomm-ui/react/header-bar"
import {Icon} from "@qualcomm-ui/react/icon"
export function HeaderBarSizesDemo(): ReactElement {
return (
<div className="flex w-full flex-col gap-4">
<HeaderBar.Root className="@container">
<HeaderContent />
</HeaderBar.Root>
<HeaderBar.Root className="@container" size="lg">
<HeaderContent />
</HeaderBar.Root>
</div>
)
}
function HeaderContent() {
return (
<>
<HeaderBar.Logo>
<div className="bg-category-1-subtle rounded-sm p-0.5">
<Icon icon={Layers2} size="lg" />
</div>
<HeaderBar.AppTitle>Qualcomm AI Visualizer</HeaderBar.AppTitle>
</HeaderBar.Logo>
<HeaderBar.Divider />
<HeaderBar.Nav className="hidden @min-[580px]:flex">
<HeaderBar.NavItem>Home</HeaderBar.NavItem>
<HeaderBar.NavItem>
<Icon icon={Settings} />
Settings
</HeaderBar.NavItem>
</HeaderBar.Nav>
<HeaderBar.ActionBar className="hidden @min-[285px]:flex">
<HeaderBar.ActionIconButton icon={Moon} />
<HeaderBar.ActionIconButton icon={Settings} />
<HeaderBar.ActionButton
className="hidden @min-[450px]:inline-flex"
startIcon={LayoutGrid}
>
Apps
</HeaderBar.ActionButton>
<HeaderBar.Divider className="hidden @min-[375px]:block" />
<Avatar.Root
className="hidden @min-[375px]:flex"
size="xs"
variant="contrast"
>
<Avatar.Content>JD</Avatar.Content>
</Avatar.Root>
</HeaderBar.ActionBar>
</>
)
}Surfaces
Use the surface prop to set the background color. Available options are primary (default) and secondary.
import type {ReactElement} from "react"
import {Layers2, LayoutGrid, Moon, Settings} from "lucide-react"
import {Avatar} from "@qualcomm-ui/react/avatar"
import {HeaderBar} from "@qualcomm-ui/react/header-bar"
import {Icon} from "@qualcomm-ui/react/icon"
export function HeaderBarSurfacesDemo(): ReactElement {
return (
<div className="flex w-full flex-col gap-4">
<HeaderBar.Root className="@container">
<HeaderContent />
</HeaderBar.Root>
<HeaderBar.Root className="@container" surface="secondary">
<HeaderContent />
</HeaderBar.Root>
</div>
)
}
function HeaderContent() {
return (
<>
<HeaderBar.Logo>
<div className="bg-category-1-subtle rounded-sm p-0.5">
<Icon icon={Layers2} size="lg" />
</div>
<HeaderBar.AppTitle>Qualcomm AI Visualizer</HeaderBar.AppTitle>
</HeaderBar.Logo>
<HeaderBar.Divider />
<HeaderBar.Nav className="hidden @min-[580px]:flex">
<HeaderBar.NavItem>Home</HeaderBar.NavItem>
<HeaderBar.NavItem>
<Icon icon={Settings} />
Settings
</HeaderBar.NavItem>
</HeaderBar.Nav>
<HeaderBar.ActionBar className="hidden @min-[285px]:flex">
<HeaderBar.ActionIconButton icon={Moon} />
<HeaderBar.ActionIconButton icon={Settings} />
<HeaderBar.ActionButton
className="hidden @min-[450px]:inline-flex"
startIcon={LayoutGrid}
>
Apps
</HeaderBar.ActionButton>
<HeaderBar.Divider className="hidden @min-[375px]:block" />
<Avatar.Root
className="hidden @min-[375px]:flex"
size="xs"
variant="contrast"
>
<Avatar.Content>JD</Avatar.Content>
</Avatar.Root>
</HeaderBar.ActionBar>
</>
)
}Menu Items
Render a menu nav item with the HeaderBar.MenuItem component. This component must be wrapped in a Menu.
import {AArrowDownIcon, Layers2} from "lucide-react"
import {HeaderBar} from "@qualcomm-ui/react/header-bar"
import {Icon} from "@qualcomm-ui/react/icon"
import {Menu} from "@qualcomm-ui/react/menu"
import {Portal} from "@qualcomm-ui/react-core/portal"
export function HeaderBarMenuItemDemo() {
return (
<HeaderBar.Root>
<HeaderBar.Logo>
<div className="bg-category-1-subtle rounded-sm p-0.5">
<Icon icon={Layers2} size="lg" />
</div>
<HeaderBar.AppTitle>Qualcomm AI Visualizer</HeaderBar.AppTitle>
</HeaderBar.Logo>
<HeaderBar.Divider />
<HeaderBar.Nav>
<HeaderBar.NavItem>Home</HeaderBar.NavItem>
<Menu.Root>
<Menu.Trigger>
<HeaderBar.MenuItem>Menu Item</HeaderBar.MenuItem>
</Menu.Trigger>
<Portal>
<Menu.Positioner>
<Menu.Content>
{["Menu Item 1", "Menu Item 2", "Menu Item 3"].map((entry) => (
<Menu.Item key={entry} value={entry}>
<Menu.ItemStartIcon icon={AArrowDownIcon} />
<Menu.ItemLabel>{entry}</Menu.ItemLabel>
</Menu.Item>
))}
</Menu.Content>
</Menu.Positioner>
</Portal>
</Menu.Root>
</HeaderBar.Nav>
</HeaderBar.Root>
)
}API
<HeaderBar.Root>
| Prop | Type | Default |
|---|---|---|
Allows you to replace the component's HTML element with a different tag or component. Learn more | | ReactElement | |
The size of the component and its elements. Governs padding, element spacing,
and height. | 'sm' | 'lg' | 'sm' |
The background color of the component. | | 'primary' |
| ReactElement
| ((
props: object,
) => ReactElement)
'sm' | 'lg'
| 'primary'
| 'secondary'
| Attribute / Property | Value |
|---|---|
className | 'qui-header-bar__root' |
data-size | 'sm' | 'lg' |
data-surface | | 'primary' |
className'qui-header-bar__root'data-size'sm' | 'lg'
data-surface| 'primary'
| 'secondary'
<HeaderBar.ActionBar>
| Prop | Type |
|---|---|
Allows you to replace the component's HTML element with a different tag or component. Learn more | | ReactElement |
| ReactElement
| ((
props: object,
) => ReactElement)
| Attribute / Property | Value |
|---|---|
className | 'qui-header-bar__action-bar' |
className'qui-header-bar__action-bar'<HeaderBar.ActionButton>
| Prop | Type |
|---|---|
| LucideIcon | |
Allows you to replace the component's HTML element with a different tag or component. Learn more | | ReactElement |
| LucideIcon |
| LucideIcon
| ReactNode
LucideIcon, the size will automatically match the size prop.
Supply as a ReactElement for additional customization.| ReactElement
| ((
props: object,
) => ReactElement)
QdsHeaderBarActionButtonBindings<HeaderBar.ActionIconButton>
| Prop | Type |
|---|---|
icon * lucide-react icon. Can be supplied as a
ReactElement for additional customization. | | LucideIcon |
Allows you to replace the component's HTML element with a different tag or component. Learn more | | ReactElement |
| LucideIcon
| ReactNode
ReactElement for additional customization.| ReactElement
| ((
props: object,
) => ReactElement)
QdsHeaderBarActionIconButtonBindings<HeaderBar.AppTitle>
| Prop | Type |
|---|---|
Allows you to replace the component's HTML element with a different tag or component. Learn more | | ReactElement |
| ReactElement
| ((
props: object,
) => ReactElement)
| Attribute / Property | Value |
|---|---|
className | 'qui-header-bar__app-title' |
className'qui-header-bar__app-title'<HeaderBar.Divider>
| Prop | Type |
|---|---|
Allows you to replace the component's HTML element with a different tag or component. Learn more | | ReactElement |
| ReactElement
| ((
props: object,
) => ReactElement)
| Attribute / Property | Value |
|---|---|
className | 'qui-header-bar__divider' |
className'qui-header-bar__divider'<HeaderBar.Logo>
| Prop | Type |
|---|---|
Allows you to replace the component's HTML element with a different tag or component. Learn more | | ReactElement |
| ReactElement
| ((
props: object,
) => ReactElement)
| Attribute / Property | Value |
|---|---|
className | 'qui-header-bar__logo' |
className'qui-header-bar__logo'<HeaderBar.MenuItem>
| Prop | Type |
|---|---|
lucide-react icon. Can be supplied as a
ReactElement for additional customization. | | LucideIcon |
Allows you to replace the component's HTML element with a different tag or component. Learn more | | ReactElement |
| LucideIcon
| ReactNode
ReactElement for additional customization.| ReactElement
| ((
props: object,
) => ReactElement)
QdsHeaderBarMenuItemBindings<HeaderBar.NavItem>
| Prop | Type |
|---|---|
Whether the nav item is the current active route. | boolean |
| LucideIcon | |
Allows you to replace the component's HTML element with a different tag or component. Learn more | | ReactElement |
| LucideIcon |
boolean| LucideIcon
| ReactNode
LucideIcon, the size will automatically match the size prop.
Supply as a ReactElement for additional customization.| ReactElement
| ((
props: object,
) => ReactElement)
| Attribute / Property | Value |
|---|---|
className | 'qui-header-bar__nav-item' |
data-active |
className'qui-header-bar__nav-item'data-active<HeaderBar.Nav>
| Prop | Type |
|---|---|
Allows you to replace the component's HTML element with a different tag or component. Learn more | | ReactElement |
| ReactElement
| ((
props: object,
) => ReactElement)
| Attribute / Property | Value |
|---|---|
className | 'qui-header-bar__nav' |
className'qui-header-bar__nav'<HeaderBar.WindowControls>
| Prop | Type |
|---|---|
Allows you to replace the component's HTML element with a different tag or component. Learn more | | ReactElement |
| ReactElement
| ((
props: object,
) => ReactElement)
| Attribute / Property | Value |
|---|---|
className | 'qui-header-bar__window-controls' |
className'qui-header-bar__window-controls'