Patterns
Navbar
Generic navigation using the same existing YunUI header implementation.
Use the existing YunUI navigation bar for a general website. This is the same
component as the compatible /ai export, with no AI runtime dependency or new
visual design. It owns the floating header, active-link behavior and mobile menu;
the host supplies branding, link data, account/actions slots and routing adapters.
Import
tsx1 line
import { Navbar } from "@yuhuanowo/yunui/patterns";Example
Navbar
Use with PageLayout to reserve space below the fixed header. Full API and slot
examples are on the shared Navbar page.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| account | ReactNode | — | Signed-in account control — pass an `AccountMenu`. When present it REPLACES the sign in / sign up buttons (desktop and mobile), so a reader who is already signed in sees their avatar rather than an invitation to sign in again. |
| actions | ReactNode | — | Extra controls in the right-hand cluster, before the language/theme pills — a GitHub link, a search button. Desktop only, matching the rest of that cluster; put the mobile equivalent in `mobileMenuHeader`. |
| appName* | string | — | Brand name shown next to the logo. |
| brand | ReactNode | — | Replaces the logo + wordmark block entirely. Pass a mark-only logo, a custom lockup, anything — it is still wrapped in the link to `homeHref`. Without this, a brand that is a single glyph had to be faked through `logoSrc`/`appName`, which is why YunUI's own site and YunNEWS each kept a private copy of this bar. |
| className | string | — | Extra classes on the `<nav>` element. |
| currentPath | string | / | Current route, used for active-link + scroll-spy. |
| homeHref | string | / | Where the logo links to. |
| label | string | — | Accessible name for the `<nav>` landmark. A page with more than one nav needs each one named, or a screen reader offers several identical "navigation" regions. |
| labels | { signIn?: string; signUp?: string; menu?: string | undefined; } | undefined | — | Localized auth labels. |
| languageSwitcher | ReactNode | — | Right-side control slots; the host injects the configured switcher. |
| links | NavLink[] | [] | Center navigation links. The host builds these from branding/flags/i18n. |
| loginHref | string | /login | Sign-in link destination. |
| logoSrc | string | /favicon.ico | Logo image src (default: /favicon.ico). |
| mobileMenuFooter | ReactNode | — | The bottom region of the mobile menu, under the divider. Passing this REPLACES the automatic `languageSwitcher` row there — so a host that wants the language pill alongside something else (a GitHub link, a status chip) lays that row out itself instead of getting two rows. Leave it off and the language row appears on its own, as before. |
| mobileMenuHeader | ReactNode | — | Rendered at the TOP of the mobile menu, above the links. |
| signupHref | string | /signup | Sign-up link destination. |
| themeToggle | ReactNode | — | Defaults to YunUI's ThemeToggle. |
| variant | "public" | "minimal" | public | `public` (full nav + auth) or `minimal` (no links/auth). |