NavigationNavbarBrandCenter
Searchastronomic.dev# NavbarBrandCenter
At the top of a brand-led site, such as a shop or a studio: the links at the start, the brand in the middle, the actions at the end.
Interactive: inline script.
## Usage
```astro
import NavbarBrandCenter from "@astronomic-dev/ui/components/NavbarBrandCenter.astro";
```
## Examples
### The brand in the middle
The links at the start, the brand in the middle of the bar, the action and a search link at the end. Keep the links few, so the two sides stay balanced. Below the md breakpoint the links fold into a menu button. In a frame, so the breakpoint is real.
```astro
---
import NavbarBrandCenter from "@astronomic-dev/ui/components/NavbarBrandCenter.astro";
import Star from "../../logos/astronomic-star.svg";
const links = [
{ label: "Work", href: "#work", current: true },
{ label: "Services", href: "#services" },
{ label: "About", href: "#about" },
];
const actions = [{ label: "Start a project", href: "#start" }];
---
<NavbarBrandCenter links={links} actions={actions} label="Astronomic">
<a slot="brand" href="#" class="inline-flex items-center gap-2 text-inherit no-underline">
<Star class="size-5 shrink-0" aria-hidden="true" />
Astronomic
</a>
<a slot="utilities" href="#search" aria-label="Search" class="inline-flex size-9 items-center justify-center rounded-control text-inherit">
<svg viewBox="0 0 16 16" class="size-4" aria-hidden="true">
<circle cx="7" cy="7" r="4.75" fill="none" stroke="currentColor" stroke-width="1.5" />
<path d="M10.5 10.5L14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
</svg>
</a>
</NavbarBrandCenter>
```
## Props
### NavbarBrandCenter
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `links` | `NavLink[]` | None | Required. The page links. NavLink is { label, href, current?, target?, index?, badge? }: current marks the page, target "_blank" adds rel="noopener noreferrer", index is a section number, such as "1.0", shown before the label, badge is a short tag, such as "Beta", shown after it. |
| `actions` | `NavAction[]` | `[]` | Call-to-action links, on desktop (unless the `actions` slot is used) and in the menu. NavAction is { label, href, variant?, size? }; by default the last is primary, the rest ghost, and the desktop size is sm. |
| `label` | `string` | `"Main"` | Accessible name of the navigation landmark and the mobile menu. |
| `menuTitle` | `string` | `"Menu"` | Visible title of the mobile menu panel. |
| `menuText` | `string` | None | Visible words on the mobile menu's open button, such as "Menu" (MobileMenu's openText): a bordered pill in the bar's colors in place of the icon-only button. The words name the button. Off by default. |
| `menuPanel` | `"drawer" \| "card"` | `"drawer"` | The mobile menu panel's shape (MobileMenu's panel): `drawer`, a tall floating panel with the panel corners at the end of the screen; `card`, a floating card just under the bar, on its side edges, with the card corners. |
| `class` | `string` | None | More classes, merged with cn(), so yours win on conflicts. |
| `contentClass` | `string` | None | Classes for the inner row, for example a max width that matches the page container. Merged after the recipe's layout with cn(), so yours win at the same breakpoint: to override a recipe's layout class, use the fold point's own prefix (nav-md: or nav-lg:, as collapse), which moves with the fold. |
| `linksClass` | `string` | None | Classes for the desktop link list, for example its type size, weight, gap or color. Merged after the recipe's own with cn(), so yours win at the same breakpoint: to override a recipe's layout class, use the fold point's own prefix (nav-md: or nav-lg:, as collapse), which moves with the fold. |
| `linkStyle` | `"plain" \| "rule"` | `"plain"` | Desktop link look: a color change, or a straight bottom rule on hover and on the current page (square corners, and a square focus ring). |
| `collapse` | `"md" \| "lg"` | `"md"` | Below which fold point the links fold into the menu button: md is 768 pixels, lg is 1024. Use lg when the links, actions and utilities need more room. A theme moves either one with --breakpoint-nav-md or --breakpoint-nav-lg in its own @theme (after the kit's theme.css), for example --breakpoint-nav-lg: 1100px; the bar, the recipes' layouts, the menu's loading and the sticky inset all follow. |
| `sticky` | `boolean` | `false` | Keeps the bar at the top of the window as the page scrolls, above the page content and below the open menu. It keeps the bar's background and blur. The page gets scroll-padding-top (--ui-nav-offset, default 6rem, or 7rem when floating), so in-page jumps and focused elements land below the bar. No script. |
| `floating` | `boolean` | `false` | Sets the bar in from the page edges, with the card corner radius, edge and shadow, and no bottom rule. The page shows around it. Where a preset has no shadow, the edge alone marks it. With sticky, it sticks with that gap above it. |
| `shrink` | `boolean` | `false` | With floating: once the page scrolls a little, the bar narrows to the width its content needs (the brand, the links and the actions, with no empty space between them), centered, and widens again at the top. It implies sticky. Only above the fold point (collapse); below it the bar keeps its width. The header's height never changes, so the page does not move. A small script animates the width (no animation under reduced motion); without it the bar is sticky at its normal width. Ignored without floating. |
| `roll` | `boolean` | `false` | Each link label, in the bar and in the menu, rolls up on hover and keyboard focus and the same words roll in from below (the text-roll utility). Only the label rolls: the index and the badge stay put. Read once. Still under reduced motion and the theme's calm setting (data-motion="calm"), and a hover counts only on a device that hovers. |
| `phone` | `NavPhone` | None | A number to call. NavPhone is { number, label?, icon, callText?, iconOnlyBelow? }: a PhoneLink in the end group before the actions, at every width (the label over the number above the fold point, a 44px round link with your icon below it, named the same), and a "Call {number}" row at the end of the menu (callText sets its words, {number} filled in by the number as written; the words name the row link, so keep the number in them). iconOnlyBelow sets where the bar phone folds: unset, with the links (collapse); "nav-phone", at theme.css --breakpoint-nav-phone (md by default; your theme sets it), so the number stays after the links fold. The icon is required. Off by default. |
| Slot | Description |
| --- | --- |
| `brand` | The logo or site name, in the middle of the bar; at the start below the fold point. |
| `actions` | Your own actions, in place of the actions buttons on desktop. The mobile menu shows it too when actions is empty. Buttons you put here should pass tone="band", so they take the band colors under a band preset. |
| `utilities` | Extra controls after the actions, shown at every width, such as a theme switch. |
| `emergency` | First in the end group, at every width: an emergency line, such as a PhoneLink with urgent. Pass tone="band" and iconOnlyBelow to match the bar. |
| `menu` | More for the mobile menu panel, after the actions, with or without them: a control that sits in the bar on wider screens but has no room there on a narrow phone, such as a theme switch with visible text below 360px. Show each copy at its own widths with your classes. It may hold a part with a script. Without JavaScript the panel cannot open, so it is not shown: keep anything that must work with no script in the bar. |
Any other attribute goes on the <header>.
## Accessibility
| Key | Action |
| --- | --- |
| Tab | Moves through the links, the brand, the actions, then the utilities |
| Enter | Follows the focused link |
- A <header> holds a <nav> named by label (default "Main").
- The link with current set gets aria-current="page".
- Below the md breakpoint the links and actions move into MobileMenu, a native dialog with a small script. Without JavaScript the menu button is hidden and the links show as a row of their own under the brand.
- Put a link with text or alt text in the brand slot, so the brand has a name.
- With sticky, in-page jumps and focused elements land below the bar: the kit sets scroll-padding-top on a page with a sticky bar, 6rem, or 7rem when it floats. A site with a taller bar sets --ui-nav-offset to its height.
- With phone, the number is one link named "Call (614) 555-0147", or by its label and the number ("Call us: (614) 555-0147"), at every width; below the fold point it is a 44px round link with the icon only, and the menu ends with a "Call {number}" row named by its words.
- With shrink, the bar only changes width: the Tab order, the focus ring and the open menu (which covers the bar) stay the same, and under reduced motion or the calm setting it switches with no animation.
- The Tab order follows the screen: links, brand, then actions.
NavbarBrandCenter
FreeAt the top of a brand-led site, such as a shop or a studio: the links at the start, the brand in the middle, the actions at the end.
- File
- NavbarBrandCenter.astro
- Group
- Navigation
- Kind
- Interactive: inline script
- Examples
- 1
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
The brand in the middle
The links at the start, the brand in the middle of the bar, the action and a search link at the end. Keep the links few, so the two sides stay balanced. Below the md breakpoint the links fold into a menu button. In a frame, so the breakpoint is real.
Minimal · Light