ComponentsNavigation
The sticky bar above the content: mobile menu button, a ⌘K search trigger, contextual actions, notifications and the user menu. Translucent on glass, a hairline on solid, the same in every app.
Radix Dropdown Menu (user menu) components/top-bar.tsx, styles/navigation.csstheme · material · accent · density · font
Installation
$ pnpm add @vamos-ui/react
The whole kit as one package — get updates by bumping the version. Add the styles to globals.css: @import "@vamos-ui/react/styles.css";
Usage
import { TopBar, TopBarStart, TopBarMenuButton, TopBarSearch, TopBarSpacer, TopBarActions, UserMenu } from "@vamos-ui/react";
<TopBar>
<TopBarStart><TopBarMenuButton /></TopBarStart>
<TopBarSearch />
<TopBarSpacer />
<TopBarActions>
<NotificationCenter adapter={inbox} />
<UserMenu name="Ada Lovelace" email="ada@northwind.io" items={account} />
</TopBarActions>
</TopBar>Examples
Narrow bar
The search collapses to an icon below 560px of bar width (a container query, so it works in any layout). TopBarMenuButton shows below 768px and opens the App shell's nav sheet.
Northwind
API
TopBar
| Prop | Type | Default |
|---|---|---|
stickySticks to the top of the scrolling area (z --z-sticky). | boolean | true |
varianttransparent blends into the page until it scrolls (data-scrolled). | "bar" | "transparent" | "bar" |
scrollTargetScroll container for data-scrolled. | RefObject<HTMLElement> | window |
TopBarSearch
| Prop | Type | Default |
|---|---|---|
placeholderFrom the dictionary (topBar.search). | string | "Search or run a command…" |
shortcutKeycap hint; also aria-keyshortcuts. | string | false | "mod+k" |
onOpenWhat the button opens. | () => void | useCommandPalette().open |
TopBarMenuButton
| Prop | Type | Default |
|---|---|---|
onClickOutside App shell; inside it opens the mobile nav. | MouseEventHandler | — |
labelsAccessible name. | Partial<TopBarLabels> | { menu: "Open menu" } |
UserMenu
| Prop | Type | Default |
|---|---|---|
nameInitials, avatar colour and the trigger's name (“Account menu for …”). | string | — |
emailUnder the name in the menu header. | string | — |
avatarPhoto URL. | string | null | — |
itemsAccount entries (shared Dropdown Menu model). | MenuEntry[] | — |
showNameName + chevron next to the avatar. | boolean | false |
childrenExtra content under the header. | ReactNode | — |
alignMenu alignment. | "start" | "center" | "end" | "end" |
TopBarStart · TopBarSpacer · TopBarActions · TopBarSeparator
| Prop | Type | Default |
|---|---|---|
classNameLayout slots; TopBarSpacer pushes the rest to the end. | string | — |