Skip to content
Español

Navigate

Type to search. Press Escape to close.

    Components · js

    Navbar

    The header of a site: brand, links, actions and, on narrow screens, a panel that folds. The server sends it working — above the collapse breakpoint it is a bar, below it the panel is served open and stacked under the brand, so no link is ever out of reach. On init the burger appears, the panel folds, Escape and a click outside close it, and a sticky header condenses once the page scrolls. It is not a drawer: the panel is content in the flow, it traps no focus and never locks the page.

    CSS: css/components/navbar.css (in ivolt.css). JS: @intervolutions/ivolt/navbar or auto.js. Added in v0.6.

    Sticky headerfixtures/navbar/basic.htmlOpen alone — Sticky header
    <header class="iv-navbar" data-iv-component="navbar" data-iv-sticky="true">
      <div class="iv-navbar__inner">
        <a class="iv-navbar__brand" href="#nav-note">
          <svg viewBox="0 0 32 32" aria-hidden="true" focusable="false">
            <defs><linearGradient id="nav-brand" x1="0" y1="0" x2="32" y2="32" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#73DFFF"/><stop offset="1" stop-color="#0B6B8A"/></linearGradient></defs>
            <rect x="1" y="1" width="30" height="30" rx="9" fill="url(#nav-brand)"/>
            <path d="M10 21.5 16 9l6 12.5" fill="none" stroke="#04070F" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round"/>
          </svg>
          <span>Vantage</span>
        </a>
        <button class="iv-navbar__toggle" type="button" aria-expanded="false" aria-controls="site-nav" hidden>
          <span class="iv-u-sr-only">Menu</span>
          <span class="iv-navbar__burger" aria-hidden="true"></span>
        </button>
        <div class="iv-navbar__panel" id="site-nav">
          <nav class="iv-navbar__nav" aria-label="Main">
            <ul class="iv-navbar__links">
              <li><a class="iv-navbar__link" href="#nav-note" aria-current="page">Product</a></li>
              <li><a class="iv-navbar__link" href="#nav-scroll">Pricing</a></li>
              <li><a class="iv-navbar__link" href="#nav-scroll">Docs</a></li>
              <li><a class="iv-navbar__link" href="#nav-scroll">Changelog</a></li>
              <li><a class="iv-navbar__link" href="#nav-note">Support</a></li>
            </ul>
          </nav>
          <div class="iv-navbar__actions">
            <a class="iv-button iv-button--ghost iv-button--sm" href="#nav-note">Sign in</a>
            <a class="iv-button iv-button--primary iv-button--sm" href="#nav-note">Get started</a>
          </div>
        </div>
      </div>
    </header>
    <p id="nav-note">Sample header, not a real site: every link above points inside this page, nothing is signed in and nothing is bought. The header is sticky, so it condenses once the page scrolls past 24 pixels. Below the <code>lg</code> breakpoint the panel is served open and stacked; with JavaScript the burger appears and folds it.</p>
    <!-- The filler is a screen and a half tall on purpose: a sticky header needs something to scroll over. -->
    <section id="nav-scroll" class="iv-stack" style="min-block-size: 150vh">
      <h2>Room to scroll</h2>
      <p>The text below exists so the condensed state can be seen: it has no meaning of its own. Scroll down and the bar loses height, takes a glass background, an ambient shadow and the conductive rule along its bottom edge.</p>
      <p>The brand and the links keep their size; only the bar's height and its surface change, so nothing jumps under the pointer. The underline of a link grows from the centre on hover and on keyboard focus, and the current page keeps it drawn.</p>
      <p>On a narrow screen the panel folds. Opening it turns the burger into a cross, the panel slides in from above and its height is capped to the viewport minus the bar, so a long menu scrolls inside itself instead of pushing the page.</p>
      <p>Escape closes the panel and returns the focus to the burger, a click outside closes it too, and crossing the breakpoint closes it and hands the layout back to the bar.</p>
      <p>Nothing here is fetched, stored or sent. The fixture is one header and this filler.</p>
      <p>Last paragraph of the filler, so the page is taller than the viewport at every width tested.</p>
    </section>
    // data-iv-component="navbar"
    {
      sticky: true,
    }
    Reading this page

    Each header below runs in a page of its own, embedded here: the bar sticks, condenses and folds against that page, not against this article. Scroll inside a stage to watch the bar hold its place, change its width to 390 to see it fold, or open it alone from the bar above it.

    A megamenu inside the panel

    A megamenu can live inside iv-navbar__panel. From the lg breakpoint up its panels float under the whole bar; below it the navbar folds and the same panels behave as an accordion inside it. Pass data-iv-overlay="false" to the hosted menu: inside a header the bar is already the raised surface, and a scrim under it would dim the header itself.

    Navbar hosting a megamenufixtures/navbar/megamenu.htmlOpen alone — Navbar hosting a megamenu
    <header class="iv-navbar" data-iv-component="navbar" data-iv-sticky="true">
      <div class="iv-navbar__inner">
        <a class="iv-navbar__brand" href="#nav-mm-note">
          <svg viewBox="0 0 32 32" aria-hidden="true" focusable="false">
            <defs><linearGradient id="nav-mm-brand" x1="0" y1="32" x2="32" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0B6B8A"/><stop offset="1" stop-color="#73DFFF"/></linearGradient></defs>
            <circle cx="16" cy="16" r="15" fill="url(#nav-mm-brand)"/>
            <path d="M9 16h14M16 9v14" stroke="#04070F" stroke-width="2.6" stroke-linecap="round"/>
          </svg>
          <span>Vantage</span>
        </a>
        <button class="iv-navbar__toggle" type="button" aria-expanded="false" aria-controls="mega-nav" hidden>
          <span class="iv-u-sr-only">Menu</span>
          <span class="iv-navbar__burger" aria-hidden="true"></span>
        </button>
        <div class="iv-navbar__panel" id="mega-nav">
          <nav class="iv-megamenu" data-iv-component="megamenu" data-iv-overlay="false" style="--iv-megamenu-width: min(56rem, 100vw - 2rem)" aria-label="Main. Every section, count and figure below is made up for this demo.">
            <ul class="iv-megamenu__list">
              <li class="iv-megamenu__item">
                <a class="iv-megamenu__link" href="#nav-mm-note">Platform</a>
                <button class="iv-megamenu__toggle" type="button" aria-expanded="false" aria-controls="nav-mm-platform" hidden><span class="iv-u-sr-only">Open Platform</span></button>
                <section class="iv-megamenu__panel" id="nav-mm-platform" aria-labelledby="nav-mm-platform-title">
                  <header class="iv-megamenu__head">
                    <p class="iv-megamenu__overline">Explore the platform</p>
                    <h2 class="iv-megamenu__title" id="nav-mm-platform-title">Platform <span class="iv-megamenu__count">24 parts</span></h2>
                    <p class="iv-megamenu__tagline">Made-up sections, no catalogue behind them.</p>
                    <button class="iv-megamenu__close" type="button" aria-label="Close Platform" hidden></button>
                  </header>
                  <div class="iv-megamenu__body">
                    <aside class="iv-megamenu__directory">
                      <h3 class="iv-megamenu__heading">Where to start</h3>
                      <ul class="iv-megamenu__dirlist">
                        <li><a href="#nav-mm-note"><span>Components</span><small>24</small></a></li>
                        <li><a href="#nav-mm-note"><span>Tokens</span><small>133</small></a></li>
                        <li><a href="#nav-mm-note"><span>Themes</span><small>4</small></a></li>
                        <li><a href="#nav-mm-note"><span>Layouts</span><small>9</small></a></li>
                      </ul>
                      <a class="iv-megamenu__all" href="#nav-mm-note">Browse the sample</a>
                    </aside>
                    <div class="iv-megamenu__discover">
                      <div class="iv-megamenu__tabs" role="tablist" aria-label="Platform selections">
                        <a class="iv-megamenu__tab" role="tab" id="nav-mm-platform-tab-0" href="#nav-mm-platform-set-0" aria-selected="true">Build</a>
                        <a class="iv-megamenu__tab" role="tab" id="nav-mm-platform-tab-1" href="#nav-mm-platform-set-1" aria-selected="false">Ship</a>
                      </div>
                      <div class="iv-megamenu__set" id="nav-mm-platform-set-0" role="tabpanel" aria-labelledby="nav-mm-platform-tab-0">
                        <ul class="iv-megamenu__cards">
                          <li><a class="iv-megamenu__card" href="#nav-mm-note">
                            <span class="iv-megamenu__art"><svg viewBox="0 0 320 200" aria-hidden="true" focusable="false" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="nmm1" x1="0" y1="0" x2="320" y2="200" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#171A45"/><stop offset="1" stop-color="#04070F"/></linearGradient></defs><rect width="320" height="200" fill="url(#nmm1)"/><circle cx="160" cy="100" r="58" fill="none" stroke="#8B95FF" stroke-opacity=".7" stroke-width="3"/><circle cx="160" cy="100" r="22" fill="#8B95FF" fill-opacity=".3"/></svg><span class="iv-megamenu__rank" aria-hidden="true">01</span><span class="iv-megamenu__arrow" aria-hidden="true"></span></span>
                            <span class="iv-megamenu__name">Components</span>
                            <span class="iv-megamenu__meta">24 parts</span>
                          </a></li>
                          <li><a class="iv-megamenu__card" href="#nav-mm-note">
                            <span class="iv-megamenu__art"><svg viewBox="0 0 320 200" aria-hidden="true" focusable="false" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="nmm2" x1="0" y1="0" x2="320" y2="200" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0C1330"/><stop offset="1" stop-color="#2266D8"/></linearGradient></defs><rect width="320" height="200" fill="url(#nmm2)"/><path d="M-10 170 90 92l70 52 80-66 100 74v50H-10z" fill="#04070F" fill-opacity=".7"/><circle cx="246" cy="48" r="26" fill="#B3D6FF" fill-opacity=".85"/></svg><span class="iv-megamenu__rank" aria-hidden="true">02</span><span class="iv-megamenu__arrow" aria-hidden="true"></span></span>
                            <span class="iv-megamenu__name">Tokens</span>
                            <span class="iv-megamenu__meta">133 values</span>
                          </a></li>
                          <li><a class="iv-megamenu__card" href="#nav-mm-note">
                            <span class="iv-megamenu__art"><svg viewBox="0 0 320 200" aria-hidden="true" focusable="false" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="nmm3" x1="0" y1="0" x2="320" y2="200" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#2266D8"/><stop offset="1" stop-color="#0C1330"/></linearGradient></defs><rect width="320" height="200" fill="url(#nmm3)"/><path d="M16 200 160 24l144 176z" fill="#8FE3FF" fill-opacity=".24"/><path d="M108 200 160 120l52 80z" fill="#F5F7FC" fill-opacity=".55"/></svg><span class="iv-megamenu__rank" aria-hidden="true">03</span><span class="iv-megamenu__arrow" aria-hidden="true"></span></span>
                            <span class="iv-megamenu__name">Themes</span>
                            <span class="iv-megamenu__meta">4 presets</span>
                          </a></li>
                        </ul>
                      </div>
                      <div class="iv-megamenu__set" id="nav-mm-platform-set-1" role="tabpanel" aria-labelledby="nav-mm-platform-tab-1" hidden>
                        <ul class="iv-megamenu__cards">
                          <li><a class="iv-megamenu__card" href="#nav-mm-note">
                            <span class="iv-megamenu__art"><svg viewBox="0 0 320 200" aria-hidden="true" focusable="false" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="nmm4" x1="0" y1="0" x2="320" y2="200" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#262C6E"/><stop offset="1" stop-color="#04070F"/></linearGradient></defs><rect width="320" height="200" fill="url(#nmm4)"/><rect x="56" y="44" width="208" height="112" rx="10" fill="none" stroke="#FF9AA4" stroke-opacity=".6" stroke-width="3"/><path d="M88 124h64M88 100h144M88 76h104" stroke="#FF9AA4" stroke-opacity=".65" stroke-width="6" stroke-linecap="round"/></svg><span class="iv-megamenu__rank" aria-hidden="true">01</span><span class="iv-megamenu__arrow" aria-hidden="true"></span></span>
                            <span class="iv-megamenu__name">Bundles</span>
                            <span class="iv-megamenu__meta">2 entries</span>
                          </a></li>
                          <li><a class="iv-megamenu__card" href="#nav-mm-note">
                            <span class="iv-megamenu__art"><svg viewBox="0 0 320 200" aria-hidden="true" focusable="false" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="nmm5" x1="0" y1="0" x2="320" y2="200" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#094D63"/><stop offset="1" stop-color="#04070F"/></linearGradient></defs><rect width="320" height="200" fill="url(#nmm5)"/><circle cx="160" cy="100" r="58" fill="none" stroke="#73DFFF" stroke-opacity=".7" stroke-width="3"/><circle cx="160" cy="100" r="22" fill="#73DFFF" fill-opacity=".3"/></svg><span class="iv-megamenu__rank" aria-hidden="true">02</span><span class="iv-megamenu__arrow" aria-hidden="true"></span></span>
                            <span class="iv-megamenu__name">Budgets</span>
                            <span class="iv-megamenu__meta">2 ceilings</span>
                          </a></li>
                          <li><a class="iv-megamenu__card" href="#nav-mm-note">
                            <span class="iv-megamenu__art"><svg viewBox="0 0 320 200" aria-hidden="true" focusable="false" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="nmm6" x1="0" y1="0" x2="320" y2="200" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0C1330"/><stop offset="1" stop-color="#4F5BE6"/></linearGradient></defs><rect width="320" height="200" fill="url(#nmm6)"/><path d="M-10 170 90 92l70 52 80-66 100 74v50H-10z" fill="#04070F" fill-opacity=".7"/><circle cx="246" cy="48" r="26" fill="#C2C8FF" fill-opacity=".85"/></svg><span class="iv-megamenu__rank" aria-hidden="true">03</span><span class="iv-megamenu__arrow" aria-hidden="true"></span></span>
                            <span class="iv-megamenu__name">Checks</span>
                            <span class="iv-megamenu__meta">3 engines</span>
                          </a></li>
                        </ul>
                      </div>
                    </div>
                  </div>
                  <footer class="iv-megamenu__foot">
                    <span class="iv-megamenu__crumb">Vantage <b aria-hidden="true">/</b> Platform</span>
                    <a class="iv-megamenu__foot-link" href="#nav-mm-note">Open the sample</a>
                    <p class="iv-megamenu__status" aria-hidden="true"><span class="iv-megamenu__prompt">vantage:~$</span><span class="iv-megamenu__cmd">ls /platform</span><span class="iv-megamenu__caret-blink"></span><span class="iv-megamenu__hint">Esc to close</span></p>
                  </footer>
                </section>
              </li>
              <li class="iv-megamenu__item">
                <a class="iv-megamenu__link" href="#nav-mm-note">Resources</a>
                <button class="iv-megamenu__toggle" type="button" aria-expanded="false" aria-controls="nav-mm-resources" hidden><span class="iv-u-sr-only">Open Resources</span></button>
                <section class="iv-megamenu__panel" id="nav-mm-resources" aria-labelledby="nav-mm-resources-title">
                  <header class="iv-megamenu__head">
                    <p class="iv-megamenu__overline">Explore the library</p>
                    <h2 class="iv-megamenu__title" id="nav-mm-resources-title">Resources <span class="iv-megamenu__count">38 pages</span></h2>
                    <p class="iv-megamenu__tagline">Fictional library, fictional dates.</p>
                    <button class="iv-megamenu__close" type="button" aria-label="Close Resources" hidden></button>
                  </header>
                  <div class="iv-megamenu__body">
                    <aside class="iv-megamenu__directory">
                      <h3 class="iv-megamenu__heading">Where to start</h3>
                      <ul class="iv-megamenu__dirlist">
                        <li><a href="#nav-mm-note"><span>Guides</span><small>12</small></a></li>
                        <li><a href="#nav-mm-note"><span>Recipes</span><small>5</small></a></li>
                        <li><a href="#nav-mm-note"><span>Field notes</span><small>21</small></a></li>
                      </ul>
                      <a class="iv-megamenu__all" href="#nav-mm-note">Browse the sample</a>
                    </aside>
                    <div class="iv-megamenu__discover">
                      <div class="iv-megamenu__tabs" role="tablist" aria-label="Resources selections">
                        <a class="iv-megamenu__tab" role="tab" id="nav-mm-resources-tab-0" href="#nav-mm-resources-set-0" aria-selected="true">Learn</a>
                        <a class="iv-megamenu__tab" role="tab" id="nav-mm-resources-tab-1" href="#nav-mm-resources-set-1" aria-selected="false">Watch</a>
                      </div>
                      <div class="iv-megamenu__set" id="nav-mm-resources-set-0" role="tabpanel" aria-labelledby="nav-mm-resources-tab-0">
                        <ul class="iv-megamenu__cards">
                          <li><a class="iv-megamenu__card" href="#nav-mm-note">
                            <span class="iv-megamenu__art"><svg viewBox="0 0 320 200" aria-hidden="true" focusable="false" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="nmm7" x1="0" y1="0" x2="320" y2="200" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#2266D8"/><stop offset="1" stop-color="#0F1D4D"/></linearGradient></defs><rect width="320" height="200" fill="url(#nmm7)"/><path d="M16 200 160 24l144 176z" fill="#66B1FF" fill-opacity=".24"/><path d="M108 200 160 120l52 80z" fill="#EAF4FF" fill-opacity=".55"/></svg><span class="iv-megamenu__rank" aria-hidden="true">01</span><span class="iv-megamenu__arrow" aria-hidden="true"></span></span>
                            <span class="iv-megamenu__name">Guides</span>
                            <span class="iv-megamenu__meta">12 pages</span>
                          </a></li>
                          <li><a class="iv-megamenu__card" href="#nav-mm-note">
                            <span class="iv-megamenu__art"><svg viewBox="0 0 320 200" aria-hidden="true" focusable="false" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="nmm8" x1="0" y1="0" x2="320" y2="200" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#1C2544"/><stop offset="1" stop-color="#04070F"/></linearGradient></defs><rect width="320" height="200" fill="url(#nmm8)"/><rect x="56" y="44" width="208" height="112" rx="10" fill="none" stroke="#8FE3FF" stroke-opacity=".6" stroke-width="3"/><path d="M88 124h64M88 100h144M88 76h104" stroke="#D6E9FF" stroke-opacity=".65" stroke-width="6" stroke-linecap="round"/></svg><span class="iv-megamenu__rank" aria-hidden="true">02</span><span class="iv-megamenu__arrow" aria-hidden="true"></span></span>
                            <span class="iv-megamenu__name">Recipes</span>
                            <span class="iv-megamenu__meta">5 samples</span>
                          </a></li>
                          <li><a class="iv-megamenu__card" href="#nav-mm-note">
                            <span class="iv-megamenu__art"><svg viewBox="0 0 320 200" aria-hidden="true" focusable="false" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="nmm9" x1="0" y1="0" x2="320" y2="200" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0F1D4D"/><stop offset="1" stop-color="#04070F"/></linearGradient></defs><rect width="320" height="200" fill="url(#nmm9)"/><circle cx="160" cy="100" r="58" fill="none" stroke="#FF9AA4" stroke-opacity=".7" stroke-width="3"/><circle cx="160" cy="100" r="22" fill="#FF9AA4" fill-opacity=".3"/></svg><span class="iv-megamenu__rank" aria-hidden="true">03</span><span class="iv-megamenu__arrow" aria-hidden="true"></span></span>
                            <span class="iv-megamenu__name">Field notes</span>
                            <span class="iv-megamenu__meta">21 posts</span>
                          </a></li>
                        </ul>
                      </div>
                      <div class="iv-megamenu__set" id="nav-mm-resources-set-1" role="tabpanel" aria-labelledby="nav-mm-resources-tab-1" hidden>
                        <ul class="iv-megamenu__cards">
                          <li><a class="iv-megamenu__card" href="#nav-mm-note">
                            <span class="iv-megamenu__art"><svg viewBox="0 0 320 200" aria-hidden="true" focusable="false" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="nmm10" x1="0" y1="0" x2="320" y2="200" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0C1330"/><stop offset="1" stop-color="#17AAD6"/></linearGradient></defs><rect width="320" height="200" fill="url(#nmm10)"/><path d="M-10 170 90 92l70 52 80-66 100 74v50H-10z" fill="#04070F" fill-opacity=".7"/><circle cx="246" cy="48" r="26" fill="#A6EFFF" fill-opacity=".85"/></svg><span class="iv-megamenu__rank" aria-hidden="true">01</span><span class="iv-megamenu__arrow" aria-hidden="true"></span></span>
                            <span class="iv-megamenu__name">Walkthroughs</span>
                            <span class="iv-megamenu__meta">7 clips</span>
                          </a></li>
                          <li><a class="iv-megamenu__card" href="#nav-mm-note">
                            <span class="iv-megamenu__art"><svg viewBox="0 0 320 200" aria-hidden="true" focusable="false" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="nmm11" x1="0" y1="0" x2="320" y2="200" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#2266D8"/><stop offset="1" stop-color="#171A45"/></linearGradient></defs><rect width="320" height="200" fill="url(#nmm11)"/><path d="M16 200 160 24l144 176z" fill="#8B95FF" fill-opacity=".24"/><path d="M108 200 160 120l52 80z" fill="#EEF0FF" fill-opacity=".55"/></svg><span class="iv-megamenu__rank" aria-hidden="true">02</span><span class="iv-megamenu__arrow" aria-hidden="true"></span></span>
                            <span class="iv-megamenu__name">Sessions</span>
                            <span class="iv-megamenu__meta">4 clips</span>
                          </a></li>
                          <li><a class="iv-megamenu__card" href="#nav-mm-note">
                            <span class="iv-megamenu__art"><svg viewBox="0 0 320 200" aria-hidden="true" focusable="false" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="nmm12" x1="0" y1="0" x2="320" y2="200" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#172F7A"/><stop offset="1" stop-color="#04070F"/></linearGradient></defs><rect width="320" height="200" fill="url(#nmm12)"/><rect x="56" y="44" width="208" height="112" rx="10" fill="none" stroke="#66B1FF" stroke-opacity=".6" stroke-width="3"/><path d="M88 124h64M88 100h144M88 76h104" stroke="#B3D6FF" stroke-opacity=".65" stroke-width="6" stroke-linecap="round"/></svg><span class="iv-megamenu__rank" aria-hidden="true">03</span><span class="iv-megamenu__arrow" aria-hidden="true"></span></span>
                            <span class="iv-megamenu__name">Talks</span>
                            <span class="iv-megamenu__meta">3 clips</span>
                          </a></li>
                        </ul>
                      </div>
                    </div>
                  </div>
                  <footer class="iv-megamenu__foot">
                    <span class="iv-megamenu__crumb">Vantage <b aria-hidden="true">/</b> Resources</span>
                    <a class="iv-megamenu__foot-link" href="#nav-mm-note">Open the sample</a>
                    <p class="iv-megamenu__status" aria-hidden="true"><span class="iv-megamenu__prompt">vantage:~$</span><span class="iv-megamenu__cmd">ls /resources</span><span class="iv-megamenu__caret-blink"></span><span class="iv-megamenu__hint">Esc to close</span></p>
                  </footer>
                </section>
              </li>
              <li class="iv-megamenu__item">
                <a class="iv-megamenu__link" href="#nav-mm-note">Pricing</a>
              </li>
            </ul>
          </nav>
          <div class="iv-navbar__actions">
            <a class="iv-button iv-button--ghost iv-button--sm" href="#nav-mm-note">Sign in</a>
            <a class="iv-button iv-button--primary iv-button--sm" href="#nav-mm-note">Get started</a>
          </div>
        </div>
      </div>
    </header>
    <p id="nav-mm-note">Sample header with a megamenu inside its panel: every link points to this note, nothing is signed in and nothing is bought. The panel is capped at <code>56rem</code> through <code>--iv-megamenu-width</code>, because inside a header the bar is not centred on the page and a full-width panel would hang off the viewport. The menu runs without its page overlay: inside a header the bar is already the elevated surface, and a scrim under it would dim the header itself. From the <code>lg</code> breakpoint upwards the megamenu panels float under the whole bar; below it, the navbar folds and the same panels behave as an accordion inside it.</p>
    <!-- The filler is a screen and a half tall on purpose: a sticky header needs something to scroll over. -->
    <section id="nav-mm-scroll" class="iv-stack" style="min-block-size: 150vh">
      <h2>Room to scroll</h2>
      <p>Filler text, so the sticky header can be seen condensing while a megamenu panel is open. The header sits above the megamenu overlay on purpose: the bar you are reading from must stay legible while the page behind it dims.</p>
      <p>Nothing on this page is fetched from anywhere.</p>
      <p>Last paragraph of the filler.</p>
    </section>
    .iv-root {
      --iv-megamenu-width: min(56rem, 100vw - 2rem);
    }
    // data-iv-component="navbar"
    // data-iv-component="megamenu"
    {
      sticky: true,
      overlay: false,
    }

    Transparent over a cover

    iv-navbar--transparent drops the background and borrows light text while the header sits over a hero; the moment it condenses or its panel opens, the surface and the page colours come back, because a transparent bar over content is unreadable. iv-navbar--glass keeps the blurred surface at every scroll position, and iv-navbar--center centres the links with the actions at the end.

    Transparent over a coverfixtures/navbar/transparent.htmlOpen alone — Transparent over a cover
    <header class="iv-navbar iv-navbar--transparent" data-iv-component="navbar" data-iv-sticky="true">
      <div class="iv-navbar__inner">
        <a class="iv-navbar__brand" href="#nav-t-note">
          <svg viewBox="0 0 32 32" aria-hidden="true" focusable="false">
            <rect x="1" y="1" width="30" height="30" rx="9" fill="none" stroke="currentColor" stroke-width="2"/>
            <path d="M10 21.5 16 9l6 12.5" fill="none" stroke="currentColor" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round"/>
          </svg>
          <span>Vantage</span>
        </a>
        <button class="iv-navbar__toggle" type="button" aria-expanded="false" aria-controls="cover-nav" hidden>
          <span class="iv-u-sr-only">Menu</span>
          <span class="iv-navbar__burger" aria-hidden="true"></span>
        </button>
        <div class="iv-navbar__panel" id="cover-nav">
          <nav class="iv-navbar__nav" aria-label="Main">
            <ul class="iv-navbar__links">
              <li><a class="iv-navbar__link" href="#nav-t-note" aria-current="page">Cover</a></li>
              <li><a class="iv-navbar__link" href="#nav-t-scroll">Story</a></li>
              <li><a class="iv-navbar__link" href="#nav-t-scroll">Cast</a></li>
              <li><a class="iv-navbar__link" href="#nav-t-note">Press</a></li>
            </ul>
          </nav>
          <div class="iv-navbar__actions">
            <a class="iv-button iv-button--primary iv-button--sm" href="#nav-t-scroll">Watch the sample</a>
          </div>
        </div>
      </div>
    </header>
    <!-- The cover slides under the transparent bar: the header is 4rem tall, so the hero starts 4rem higher and pads its own content back down. -->
    <section class="iv-hero iv-hero--cinematic iv-hero--center" id="nav-t-cover" style="margin-block-start: -4rem; padding-block-start: 6rem">
      <div class="iv-hero__media iv-texture-mesh" aria-hidden="true"></div>
      <div class="iv-hero__scrim" aria-hidden="true"></div>
      <div class="iv-hero__content">
        <p class="iv-hero__kicker">Sample fixture, not a real film</p>
        <h2 class="iv-hero__title">A bar that stays out of the way</h2>
        <p class="iv-hero__lead">Made-up copy, for the fixture only. The header has no ground of its own over the cover and borrows its light text; the moment the page scrolls it condenses, takes a glass surface and the text returns to the page colours. The cover itself is a gradient mesh: no photograph ships inside the package.</p>
        <div class="iv-hero__actions">
          <a class="iv-button iv-button--primary iv-button--lg" href="#nav-t-scroll">Read the sample notes</a>
        </div>
      </div>
    </section>
    <p id="nav-t-note">Sample cover, not a real product: every link points inside this page and nothing is played, bought or sent.</p>
    <section id="nav-t-scroll" class="iv-stack">
      <h2>Sample notes</h2>
      <p>Filler text so the page scrolls and the transparent header can be seen condensing. Once condensed it is no longer transparent: a transparent bar over page content would be unreadable, so the surface and the text colours come back.</p>
      <p>Unfolding the panel does the same thing for the same reason: an open menu needs a readable ground, whatever is behind it.</p>
      <p>Nothing on this page is fetched from anywhere. The cover is two gradients and a scrim.</p>
      <p>Last paragraph of the filler.</p>
    </section>
    // data-iv-component="navbar"
    {
      sticky: true,
    }

    Options

    OptionAttributeDefaultEffect
    collapseBelowdata-iv-collapse-belowlgBreakpoint under which the panel folds behind the burger. none never folds.
    stickydata-iv-stickyfalseKeep the header at the top of the viewport and condense it on scroll.
    condenseAtdata-iv-condense-at24Pixels of scroll before data-iv-condensed lands on the header.
    hideOnScrolldata-iv-hide-on-scrollfalseSlide the bar away while scrolling down, back on the way up. Never while the panel is open or focus is inside.
    closeOnOutsidedata-iv-close-on-outsidetrueA click outside the header closes the open panel.

    Methods and events

    open(), close(reason), toggle(), destroy(); read isOpen and isCondensed. Above the collapse breakpoint open() is a no-op and isOpen stays false: there is nothing folded to unfold.

    EventWhendetail
    iv:openiv:openedthe folded panel unfolds; the first is cancelablereason, trigger
    iv:closeiv:closedthe panel folds againreason: trigger, escape, external, api or viewport
    iv:condensethe header enters or leaves the condensed statecondensed

    Keyboard and assistive technology

    The header is a <header> landmark and the links live in a <nav> with its own label. The burger is a real button with a name for screen readers, aria-expanded and aria-controls; Enter and Space work on it, Escape closes the panel and returns focus to the burger, and Tab walks the open panel in document order. The current page carries aria-current="page". No menu roles are used: these are links, not a menu. Crossing the breakpoint upwards closes the panel and hands the layout back to the bar.

    Without JavaScript

    Everything is reachable. Above collapseBelow the panel is a bar in line with the brand; below it the panel is served open and stacked, and the burger stays hidden because it would have nothing to toggle. Folding only happens under [data-iv-js], so a script that never loads cannot hide a menu. A sticky header is styled by CSS and needs no script either; only condensing, hiding on scroll and the folded panel do.

    Folding without a layout shift

    The panel is served open and init folds it, which moves the whole page down on a phone once the script runs. To fold from the first paint, mark the root before the stylesheet with one inline line in <head>: <script>document.documentElement.setAttribute("data-iv-js", "")</script>. Below lg the panel then starts folded and the toggle appears when init shows it; from lg up the bar is inline. Only the default breakpoint is known that early. If the script could fail to load, leave the marker out: a folded panel without its toggle is worse than a shift. The showcase recipe uses it.

    Tokens and locals

    LocalDefaultWhat it moves
    --iv-navbar-height4remHeight of the bar at rest.
    --iv-navbar-height-condensed3.25remHeight once the page has scrolled past condenseAt.
    --iv-navbar-bgvar(--iv-color-bg)Surface of the bar.
    --iv-navbar-maxvar(--iv-container-max)Width the inner row is centred to.
    --iv-navbar-gapvar(--iv-space-5)Gap between brand, navigation and actions.
    --iv-navbar-z150Stacking order against the page.

    State lives in attributes, so CSS can read it: data-iv-collapsible while the viewport is below the breakpoint, data-iv-open on the unfolded panel, data-iv-condensed after the scroll, data-iv-hidden on a bar slid away. The condensed bar takes --iv-shadow-ambient and a glass background; under reduced motion nothing travels, but data-iv-hidden still moves the bar out of the way because that is state, not decoration.

    Common mistakes

    • Serving the panel closed. Without the script nothing would open it; the markup must arrive usable and fold afterwards.
    • Using the navbar as a drawer. If the navigation must cover the page and trap focus, that is drawer.
    • Combining hideOnScroll with content that anchors to the top: the bar writes scroll-padding-block-start while sticky, but a jumping header still costs orientation.
    • A hosted megamenu with its overlay left on: the scrim dims the very bar you are reading from.