# Masthead

Source: https://ecosphere.dev/docs/layout/masthead (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

The institution's name where a topbar would be, tall at rest and tightening into a navbar as the page scrolls.

`import { EcoMasthead } from "vue-ecosphere"`

## Tightening on scroll

Scroll the pane. Over the first 96px the eyebrow collapses, the padding closes and the name drops to 16px. Page titles and actions belong in a PageHeader below it, inside the scroll.

Vue (vue-ecosphere):

```vue
<!-- At the top of a page that scrolls the document: the stylesheet's scroll timeline does it all -->
<EcoMasthead eyebrow="Academic year 2026–27 · term 2" title="Ridgeview Public School" />

<!-- Inside a scrolling pane: point it at the scroller -->
<div ref="pane" style="height: 320px; overflow: auto">
  <EcoMasthead :scroller="pane" eyebrow="Academic year 2026–27 · term 2" title="Ridgeview Public School" />
  …
</div>
```

React (react-ecosphere):

```tsx
{/* At the top of a page that scrolls the document: the stylesheet's scroll timeline does it all */}
<EcoMasthead eyebrow="Academic year 2026–27 · term 2" title="Ridgeview Public School" />

{/* Inside a scrolling pane: point it at the scroller, kept in state so the masthead sees it */}
const [pane, setPane] = useState<HTMLDivElement | null>(null);

<div ref={setPane} style={{ height: 320, overflow: "auto" }}>
  <EcoMasthead scroller={pane} eyebrow="Academic year 2026–27 · term 2" title="Ridgeview Public School" />
  …
</div>
```

## States

At rest; the same header after 96px; a name longer than the header.

Vue (vue-ecosphere):

```vue
<!-- rest and tight pin a state, so a static preview does not follow the page scroll -->
<EcoMasthead rest eyebrow="Academic year 2026–27 · term 2" title="Ridgeview Public School" />
<EcoMasthead tight title="Ridgeview Public School" />
<EcoMasthead rest eyebrow="Academic year 2026–27 · term 2" title="Sri Ramakrishna Vidyamandir Senior Secondary" />
```

React (react-ecosphere):

```tsx
{/* rest and tight pin a state, so a static preview does not follow the page scroll */}
<EcoMasthead rest eyebrow="Academic year 2026–27 · term 2" title="Ridgeview Public School" />
<EcoMasthead tight title="Ridgeview Public School" />
<EcoMasthead rest eyebrow="Academic year 2026–27 · term 2" title="Sri Ramakrishna Vidyamandir Senior Secondary" />
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string` | — | The institution's name. Truncates with an ellipsis rather than wrapping. #title slot overrides it. |
| `eyebrow` | `string` | — | Year and term, and nothing else: it is the first thing to disappear. #eyebrow slot overrides it. |
| `as` | `"h1" \| "h2" \| "p"` | "h1" | Element for the name. |
| `scroller` | `HTMLElement \| string \| null` | null | The scrolling element (or a selector) when the page scrolls inside a pane. The component then drives the stylesheet's keyframes from that scroll position. |
| `tight` | `boolean` | false | Pin the tightened navbar state. |
| `rest` | `boolean` | false | Pin the tall at-rest state, so a static preview does not tighten as the page scrolls. |
| `default` | `slot` | — | Content beside the name, inside mast__in. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `ReactNode` | — | The institution's name: text or a node. Truncates with an ellipsis rather than wrapping. |
| `eyebrow` | `ReactNode` | — | Year and term, and nothing else: it is the first thing to disappear. Text or a node. |
| `as` | `"h1" \| "h2" \| "p"` | "h1" | Element for the name. |
| `scroller` | `HTMLElement \| string \| null` | null | The scrolling element (or a selector) when the page scrolls inside a pane. The component then drives the stylesheet's keyframes from that scroll position. |
| `tight` | `boolean` | false | Pin the tightened navbar state. |
| `rest` | `boolean` | false | Pin the tall at-rest state, so a static preview does not tighten as the page scrolls. |
| `children` | `ReactNode` | — | Content beside the name, inside mast__in. |
