Agentic BP DScode-first design system

AppHeader

The product's top bar: logo and environment on the start, global search in the centre, utility icons, the user and their company on the end. Not a page title.

Master

This stage is narrow, so the header is compact: menu button, logo symbol, search as an icon. Variants show it full width. Click the avatar for the account menu.

UAT-2
Search
HelpWhat's newFeedback
Acme Inc.

Usage

Put one AppHeader at the top of the app shell, full width. onNavToggle adds the menu button that opens the side nav. It is one component: logo, environment, search, actions, user and company come from props, and it uses kit Logo, Badge, Button, Tooltip and Avatar inside. environment tags the instance (UAT-2, Sandbox) so people know where they are. With searchGroups, the search opens a kit GlobalSearch in its place: one search box that grows down into the results (Recent items, scopes, arrow keys and Enter); otherwise it runs onSearch; searchShortcut only shows a hint. actions are icon buttons named by a Tooltip. The avatar opens an account menu with the name, User settings, Dark mode, Density & text size and Log out; each row shows only when its handler is passed. The header follows density: its bar, search and buttons shrink in compact and grow in comfortable. Under 800px it turns compact: the logo becomes the symbol and the search becomes an icon button beside the other icons. Under 640px, the kit's mobile break, it turns phone-sized: the environment tag goes, and the row of icon actions becomes one more button holding the same actions, so onAction still tells you which was picked. Under 480px the company badge goes too; the avatar still says who is signed in. The bar answers to its own width, not the window's. Page titles, breadcrumbs and page actions belong in the page, not here. See contracts/appheader.json for the full contract.

Do's

  • The top bar of the product shell, above every page.

Don'ts

  • Do not invent TopBar, NavBar, Header, GlobalSearch, UserBadge, UserMenu or CompanyBadge.
  • Do not put the page title, breadcrumbs or page actions in it. They belong in the page.
  • Do not put more than three icon actions in it.
  • Do not recolor the logo. Use environmentIntent for the tag, not custom colors.
  • Do not use raw hex.
<AppHeader
  onNavToggle={toggleNav}
  environment="UAT-2"
  environmentIntent="success"
  searchShortcut="Ctrl+K"
  onSearch={openSearch}
  searchGroups={[
    { heading: "Recent", items: [{ id: "r1", label: "Acme Inc. — renewal quote", icon: "description" }, { id: "r2", label: "Premium support plan", icon: "radio_button_unchecked" }, { id: "r3", label: "Q3 revenue report", icon: "bar_chart" }, { id: "r4", label: "INV-1042", icon: "description" }] },
  ]}
  searchVariant="list"
  searchIconStyle="tile"
  searchScopes={[
    { value: "products", label: "Products" },
    { value: "accounts", label: "Accounts" },
    { value: "invoices", label: "Invoices" },
  ]}
  actions={[
    { id: "help", label: "Help", icon: "help" },
    { id: "news", label: "What's new", icon: "campaign" },
    { id: "feedback", label: "Feedback", icon: "chat_info" },
  ]}
  onUserSettings={openSettings}
  onDarkModeChange={setDarkMode}
  onDensityChange={setDensity}
  onLogout={logOut}
/>