# React Native Navbar with Mega Menu (Pro)

> A marketing site navbar for React Native Web and Expo: logo, links, mega menus with columns of icon links, a featured card and a footer strip, hover intent with a sliding indicator and a panel that glides between menus, sticky with a frosted blur on scroll, CTA buttons, and a full-screen animated mobile menu with accordions. Accessible with Escape, focus return and arrow keys. Part of Patine Pro.

# Navbar Pro

`Navbar` is the top bar of a landing page or a web app's public site, built the way Vercel, Linear and Stripe build theirs. On wide screens: the logo, links, and **mega menus** (columns of links with icons and a line each, a featured card, a footer strip) that open on hover, focus or press, with an indicator that slides under the pointer and a panel that glides and resizes from one menu to the next. It sticks to the top and turns frosted with a hairline once the page scrolls. Under 768 points it becomes the logo, your main button and a menu button that opens a **full-screen menu** whose rows rise in one after another, with menus as accordions and the buttons pinned at the bottom.

```tsx
import { Navbar, useNavbarScroll } from '@patine-ui/pro';
```

```tsx live full
import { View } from 'react-native';
import { Navbar } from '@patine-ui/pro';

const product = {
  columns: [
    {
      title: 'Platform',
      links: [
        { label: 'Analytics', description: 'Funnels, retention and paths', icon: 'lineChart' },
        { label: 'Copilot', description: 'Ask your data in plain words', icon: 'sparkles', badge: 'New' },
        { label: 'Warehouse sync', description: 'Snowflake, BigQuery, Postgres', icon: 'database' },
      ],
    },
    {
      title: 'Build',
      links: [
        { label: 'SDKs', description: 'React Native, web and server', icon: 'code' },
        { label: 'API', description: 'Query events over REST', icon: 'braces' },
        { label: 'Integrations', description: '60+ tools, one click', icon: 'puzzle' },
      ],
    },
  ],
  featured: {
    eyebrow: 'Launch week',
    title: 'Copilot for every chart',
    description: 'Ask why a metric moved and get the query behind the answer.',
    icon: 'sparkles',
    color: '#4F46E5',
    cta: 'See what’s new',
  },
  footer: [
    { label: 'Changelog', icon: 'megaphone' },
    { label: 'Status', icon: 'activity', description: 'All systems normal' },
  ],
};

const solutions = {
  columns: [
    {
      title: 'By team',
      links: [
        { label: 'Product', description: 'Find what drives activation', icon: 'layers' },
        { label: 'Growth', description: 'Every channel, one funnel', icon: 'rocket' },
        { label: 'Data', description: 'Governed events, typed schemas', icon: 'database' },
      ],
    },
    {
      title: 'By stage',
      links: [
        { label: 'Startups', description: 'Free up to 1M events', icon: 'sprout' },
        { label: 'Enterprise', description: 'SSO, audit logs, SLAs', icon: 'building' },
      ],
    },
  ],
};

export default function Example() {
  return (
    <View style={{ height: 420, width: '100%' }}>
      <Navbar
        brand={{ name: 'Signal', mark: 'S', color: '#18181B' }}
        items={[
          { key: 'product', label: 'Product', menu: product },
          { key: 'solutions', label: 'Solutions', menu: solutions },
          { key: 'docs', label: 'Docs', onPress: () => {} },
          { key: 'pricing', label: 'Pricing', onPress: () => {} },
        ]}
        active="pricing"
        secondaryCta={{ label: 'Sign in' }}
        cta={{ label: 'Start for free' }}
        sticky={false}
        scrolled
      />
    </View>
  );
}
```

## Example: a developer docs site

A docs site's navbar: plain links that track the current section, a search button in `actions`, and one call to action. Narrow the window to see it fold into the menu button.

```tsx live
import { useState } from 'react';
import { View } from 'react-native';
import { Button, Text } from 'patine-ui';
import { Icon, Navbar } from '@patine-ui/pro';

const SECTIONS = [
  { key: 'guides', label: 'Guides' },
  { key: 'api', label: 'API reference' },
  { key: 'sdks', label: 'SDKs' },
  { key: 'changelog', label: 'Changelog' },
];

export default function Example() {
  const [active, setActive] = useState('guides');
  return (
    <View style={{ height: 220, width: '100%' }}>
      <Navbar
        brand={{ name: 'Relay', mark: 'R', color: '#0F766E' }}
        items={SECTIONS.map((s) => ({ ...s, onPress: () => setActive(s.key) }))}
        active={active}
        actions={
          <Button size="icon" variant="ghost" accessibilityLabel="Search the docs">
            <Icon name="search" />
          </Button>
        }
        secondaryCta={{ label: 'Dashboard' }}
        cta={{ label: 'Get an API key' }}
        sticky={false}
      />
      <Text style={{ padding: 24 }} color="textSecondary">
        {SECTIONS.find((s) => s.key === active)?.label}
      </Text>
    </View>
  );
}
```

## Mega menus

Give an item a `menu`: `columns` of links (each `{ label, description?, icon?, badge?, onPress? }`, under an optional `title`), a `featured` card for a launch or a case study (`color` fills it; text turns white), and a `footer` strip for Changelog, Status or Contact sales. Menus open after a short hover so a pointer passing over doesn't flash one; once one is open, moving along the bar switches at once, and there's a grace before closing so the pointer can travel down to the panel. A click or Enter toggles it, which is what a touch screen does.

## Sticky, frosted on scroll

On the web the bar sticks to the top of the page and watches the window: once it scrolls, the bar turns translucent with a blur behind it and a hairline under it. When your page scrolls in a ScrollView of its own, as in an Expo app, pass `scrolled` yourself; `useNavbarScroll()` gives you both halves.

```tsx
const scroll = useNavbarScroll();

<View style={{ flex: 1 }}>
  <Navbar {...nav} scrolled={scroll.scrolled} style={{ position: 'absolute', top: 0, left: 0, right: 0 }} />
  <ScrollView {...scroll} contentContainerStyle={{ paddingTop: 64 }}>{page}</ScrollView>
</View>
```

## On phones

Under 768 points the links fold into a menu button whose lines turn into an ✕. The menu covers the screen: each item rises in a beat after the one above, items with a menu open as accordions with every link and its description, and your buttons sit at the bottom within thumb reach. Back on Android and Escape on the web close it.

Press the menu button:

```tsx live device
import { View } from 'react-native';
import { Navbar } from '@patine-ui/pro';

const product = {
  columns: [
    {
      links: [
        { label: 'Analytics', description: 'Funnels, retention and paths', icon: 'lineChart' },
        { label: 'Copilot', description: 'Ask your data in plain words', icon: 'sparkles', badge: 'New' },
        { label: 'SDKs', description: 'React Native, web and server', icon: 'code' },
      ],
    },
  ],
};

export default function Example() {
  return (
    <View style={{ flex: 1 }}>
      <Navbar
        brand={{ name: 'Signal', mark: 'S', color: '#18181B' }}
        items={[
          { key: 'product', label: 'Product', menu: product },
          { key: 'docs', label: 'Docs', onPress: () => {} },
          { key: 'pricing', label: 'Pricing', onPress: () => {} },
        ]}
        secondaryCta={{ label: 'Sign in' }}
        cta={{ label: 'Start for free' }}
        sticky={false}
      />
    </View>
  );
}
```

## Accessibility

- The bar is a `banner` landmark; the links are a menu bar. An item with a menu is a button that says whether it's expanded and that it opens a menu; the current page's item is `aria-current="page"`.
- ↓ on an item opens its menu and moves into it; Escape closes it and puts focus back on the item; Tab moves through the links.
- The phone menu is a modal dialog named Menu; accordions say whether they're open. Every target is at least 44 points.
- Hover isn't needed for anything: a press opens every menu. Motion follows reduce motion.

## Props

| Prop | Type | Default |
| --- | --- | --- |
| `brand` | `{ name, mark?, color? }` | |
| `logo` | `ReactNode`, your own logo instead of the brand's tile and name | |
| `onLogoPress` | `() => void` | |
| `items` | `{ key, label, onPress?, menu? }[]` | |
| `active` | `string`, the current page's key | |
| `cta`, `secondaryCta` | `{ label, onPress? }` | |
| `actions` | `ReactNode`, before the buttons, such as a theme switch | |
| `scrolled` | `boolean`: frosted with a hairline | The window's scroll, on the web |
| `sticky` | `boolean`, sticks to the top on the web | `true` |
| `maxWidth` | `number`, the content's widest | `1200` |

## Related

- [Command palette](./command-palette): ⌘K search for the app behind the site.
- [App layout](../pro/layout): the signed-in app's sidebar and top bar.
