Header
React SDK guidance for Header.
Exact exports, props, slots, hooks, and runtime behavior belong to SDK package reference. Examples are guidance unless explicitly marked copy-paste-safe.
Review component intent and composition guidance before wiring this component into an app. Then use the live playground to confirm the rendered behavior.
Playground
- Import path:
@enadhq/enad-react-sdk/client/storefront. - Live playground: /components/layout/header.
When to use it
Use HeaderSection first when the app wants the fast path for a complete storefront header.
Use Header when the app wants a shared fixed shell and needs lower-level control over the exact chrome anatomy.
Header fits branded storefronts where the useful variations are structural:
- different mobile and desktop action clusters
- different utility link treatments
- optional or branded mega-menu panels
- drawer footer content
- different logo, navigation, and action balance across brands
Composition model
Header is the lower-level composition shell beneath the newer section-first HeaderSection path.
Header is a shell with child regions:
Header.Promotion— top strip region, often used withPromotionBarHeader.Mobile— mobile-only shell regionHeader.Desktop— desktop-only shell regionHeader.Bar— main flex row container for each shell regionHeader.Group— flexible cluster wrapperHeader.Logo— branded anchor regionHeader.NavandHeader.Link— navigation primitives, with keyed desktop panel controls viaownerKey,openPanelOnHover,closePanelOnHover, andclosePanelOnClickHeader.ActionButton— icon/text action buttons or linksHeader.MenuButton— menu trigger wired to the header’s internal drawer stateHeader.Panel— optional desktop panel region for mega menus or editorial nav content, keyed to the owning trigger with the sameownerKeyHeader.Drawer— mobile drawer wrapper tied to the same internal menu state
The root owns:
- fixed positioning
- transparent/default/overlay background behavior
- link color adaptation for overlay/transparent states
- internal mobile drawer open state used by
Header.MenuButtonandHeader.Drawer - internal desktop panel state used by
Header.LinkandHeader.Panel
The shell is shared; the structure is yours
If a storefront wants a different utility region, a different mega-menu body, or a different mobile header bar, change the child composition instead of pushing more structure into root props.
Behavior and theming guidance
Use variant="default" for solid chrome and variant="transparent" for hero-led pages where the header overlays the page opener until scroll.
Because the header stays fixed, the page body still needs to respect header height with top padding or a spacer.
For desktop mega-menu patterns, open the panel from the owning top-level Header.Link with openPanelOnHover and a stable ownerKey. Match that same ownerKey on the corresponding Header.Panel. Use closePanelOnHover on sibling or utility links so the panel collapses when focus moves away, and use closePanelOnClick on links inside the panel so the expanded header gets out of the way immediately after navigation.
If the app wants a slide-out menu, pair Header.MenuButton with Header.Drawer. The drawer content can include additional utility or branded content at the bottom.
Practical guidance
- Put navigation and utility structure in child slots
- Use
Header.Panelfor desktop-only mega-menu or editorial nav content - Give each hover-owned desktop panel a stable
ownerKey, and reuse that key on both the openingHeader.Linkand the matchingHeader.Panel - Use
Header.Linkdesktop panel controls to decide which top-level links open the mega menu and which links collapse it - Add
closePanelOnClickto mega-menu destination links so the header collapses as soon as navigation starts - Use
Header.Drawerfor mobile navigation and auxiliary drawer content - Keep
PromotionBaras a separate component and decide explicitly whether it belongs insideHeader.Promotion
If the app does not need a promotion strip or a desktop panel, simply omit those regions.
Review notes
These notes define scoped usage boundaries without claiming exact prop or runtime truth beyond SDK package reference.
Header stays scoped to layout chrome. The component can own the header shell, drawer, panel, and child-region composition; the host app still owns routing, authenticated account state, cart count truth, and search runtime wiring.
- Use
HeaderSectionfirst for the fastest complete storefront header, then useHeaderwhen the app needs lower-level control over mobile, desktop, panel, and drawer anatomy. - Treat links, action buttons, account menus, search triggers, and cart triggers as app-integrated children. Do not read this page as a router, auth, search, or cart-provider contract.
- Because the header can be fixed or overlay a hero, reserve page spacing and scroll-state behavior in the surrounding shell rather than assuming the component changes document flow for every page.
Contract scope
- Use SDK package reference for exact props, exports, slots, hooks, and runtime behavior.
- Public import:
@enadhq/enad-react-sdk/client/storefront. - Playground route: /sandbox?component=Header.
- Copy/paste scope: guidance-only. Treat examples as guidance until checked against SDK package reference.