# Product Bar

> The bar for one product: its name, its own pages and one action. It sticks to the top while the page scrolls.

```tsx
import { ActionLink, ProductBar } from '@brand-studio/ui';

export default function ProductBarDemo() {
  return (
    <div style={{ width: '100%', height: 280, overflow: 'auto' }}>
      <ProductBar
        title="Halden R"
        items={[
          { label: 'Overview', href: '#overview', current: true },
          { label: 'Tech specs', href: '#specs' },
          { label: 'Compare', href: '#compare' },
        ]}
        action={<ActionLink href="#buy" shape="pill">Buy</ActionLink>}
      />
      <div style={{ padding: '2rem 1.5rem', height: 800, color: 'var(--bs-muted)' }}>Scroll this frame: the bar stays at the top.</div>
    </div>
  );
}
```

## Installation

```sh
npm install @brand-studio/ui
```

React 18 or 19 is a peer dependency. Import the stylesheet once and wrap the app in a brand theme:

```tsx
import '@brand-studio/ui/styles.css';
import { BrandTheme, ProductBar } from '@brand-studio/ui';
import brand from './brand.json';

<BrandTheme palette={brand.tokens} mode="system">
  {/* your app */}
</BrandTheme>
```

## Usage

```tsx
import { ActionLink, ProductBar } from '@brand-studio/ui';
```

```tsx
<ProductBar
  title="Halden R"
  href="/r"
  items={[{ label: 'Overview', href: '/r', current: true }, { label: 'Tech specs', href: '/r/specs' }]}
  action={<ActionLink href="/buy" shape="pill">Buy</ActionLink>}
/>
```

Place it right after a Site Bar, or at the top of the page on its own. It sticks at `top: var(--bs-productbar-top, 0)`.

## Accessibility

- The links sit in a `<nav>` named after the product, and the current page has `aria-current="page"`.
- When the bar is narrower than 44rem, the links fold under an arrow button with `aria-expanded`. Choosing a link closes the list.

## API Reference

| Prop | Type | Default |
|---|---|---|
| `title` | `React.ReactNode` | – |
| `href?` | `string` | `'#'` |
| `items?` | `NavLink[]` | – |
| `action?` | `React.ReactNode` | – |
| `label?` | `string` | – |
| `className?` | `string` | `''` |

Source: https://brandstudio.js.org/docs/components/product-bar/
