X Enterprises
nuxt-x-affiliate

Site Header

Site-wide header that can float transparently over a hero and solidify on scroll, with config-driven nav, a working mobile menu, and optional search.

Site Header

The site-wide header. Pairs with <XAFSiteFooter>, <XAFLegalBar>, and <XAFMegaMenu> to form the full site chrome.

Rebuilt on the marketing layer's navbar. It can now start transparent over a hero and fade to solid on scroll, resolves its links, buttons, and logo from app config, and its mobile menu opens — the previous version rendered a hamburger wired to nothing.

Components

<XAFSiteHeader />

<!-- Interior page: solid, sticky, keeps its space in the flow -->
<XAFSiteHeader />

<!-- Landing page: floats over the hero, solidifies past the scroll threshold -->
<XAFSiteHeader transparent />
<XAFHeroLanding title="Gear we actually tested" :img="{ src: '/hero.jpg' }" />

Most sites configure the header once in app.config.ts and never pass props:

export default defineAppConfig({
  xAffiliate: {
    brand: { name: 'BestKitchenGear', logo: '/logo.svg' },
    header: {
      // `src` shows while transparent over the hero (usually a knockout
      // mark); `srcDark` shows once the header is solid.
      logo: { src: '/logo-white.svg', srcDark: '/logo.svg', alt: 'BestKitchenGear' },
      nav: {
        links: [
          { label: 'Reviews', to: '/reviews' },
          { label: 'Best of', to: '/best' },
        ],
        // The last button renders as the primary CTA.
        buttons: [
          { label: 'Sign in', to: '/account' },
          { label: 'Join free', to: '/join' },
        ],
      },
    },
  },
})

Props

Props always win over app config.

PropTypeDefaultDescription
transparentbooleanfalseStart transparent over a hero and fade to solid on scroll
links{ label, to }[]xAffiliate.header.nav.linksPrimary nav links
buttonsXafButton[]xAffiliate.header.nav.buttonsHeader buttons; the last is the primary CTA
logo{ src?, srcDark?, alt? }xAffiliate.header.logo, then brand.logoTransparent-state and solid-state marks
scrollThresholdnumber100Scroll distance (px) before the header turns solid
showSearchbooleantrueShow the <XAFSearchBar>
stickybooleantruePin the header to the top of the viewport

Slots

SlotDescription
logoReplace the brand link entirely
linksReplace the desktop nav links
actionsReplace the desktop button row
mobile-actionsReplace the button stack inside the mobile menu

Tips

  • transparent implies the header floats over a hero, so it leaves the document flow (position: fixed) and the hero starts at the top of the viewport. A solid header stays sticky, keeping the space it occupies — no manual top padding needed on interior pages.
  • Give the two logo slots different marks. A knockout mark that reads over a dark hero disappears against the solid white header.
  • Button variants adapt to the state: secondary buttons render soft over a hero and outline once solid. A ghost variant is promoted to outline, because a ghost button has no background and vanishes against a photo.

AI Context

component: XAFSiteHeader
package: "@xenterprises/nuxt-x-affiliate"
use-when: Site-wide header, transparent over a hero or solid on interior pages
Copyright © 2026