Header

A site or section header with a logo slot and an optional menu. Sticks to the top of the viewport by default.

When to use

  • As the first child of a top-level View on a page route.
  • For section dividers inside long pages where each section has its own primary navigation.

When not to use

  • For inline content cards — use Card.Header (a sub-component of Card) instead.
  • For the title row of a settings panel — that's Heading + Card.

Installation

pnpm add @nordcom/nordstar-header
import { Header } from '@nordcom/nordstar';

Anatomy

Header exposes three sub-components, composed inside the wrapper:

  • Header.Logo — the leftmost identity slot. Often wraps a brand mark or a <Link> back to the home page.
  • Header.Menu — the navigation list, typically rightmost on desktop.
  • Header.Menu.Link — one nav entry. Renders as a styled link.

Basic usage

Nordstar
import { Header } from '@nordcom/nordstar';

export default function Example() {
    return (
        <Header sticky={false}>
            <Header.Logo>Nordstar</Header.Logo>
        </Header>
    );
}

With navigation menu

import { Header } from '@nordcom/nordstar';

export default function Example() {
    return (
        <Header sticky={false}>
            <Header.Logo>Nordstar</Header.Logo>
            <Header.Menu>
                <Header.Menu.Link>Docs</Header.Menu.Link>
                <Header.Menu.Link>Components</Header.Menu.Link>
                <Header.Menu.Link>GitHub</Header.Menu.Link>
            </Header.Menu>
        </Header>
    );
}

(The examples above pass sticky={false} so the header doesn't stick to the preview frame's top — in production, leave it sticky.)

Composition

Pair Header with View for full-page layouts:

<View>
    <Header>
        <Header.Logo>
            <Link href="/">Acme</Link>
        </Header.Logo>
        <Header.Menu>
            <Header.Menu.Link>
                <Link href="/docs">Docs</Link>
            </Header.Menu.Link>
            <Header.Menu.Link>
                <Link href="/blog">Blog</Link>
            </Header.Menu.Link>
        </Header.Menu>
    </Header>
    <main>…</main>
</View>

Wrap the children of Header.Logo and each Header.Menu.Link in real <Link> elements when they navigate — Nordstar leaves routing to the host app.

Props

PropTypeDefaultDescription
aboutstring | undefined
accessKeystring | undefined
aria-activedescendantstring | undefinedIdentifies the currently active element when DOM focus is on a composite widget, textbox, group, or application.
aria-atomicBooleanish | undefinedIndicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.
aria-autocomplete"none" | "list" | "inline" | "both" | undefinedIndicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be presented if they are made.
aria-braillelabelstring | undefinedDefines a string value that labels the current element, which is intended to be converted into Braille.
aria-brailleroledescriptionstring | undefinedDefines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille.
aria-busyBooleanish | undefined
aria-checkedboolean | "true" | "false" | "mixed" | undefinedIndicates the current "checked" state of checkboxes, radio buttons, and other widgets.
aria-colcountnumber | undefinedDefines the total number of columns in a table, grid, or treegrid.
aria-colindexnumber | undefinedDefines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
aria-colindextextstring | undefinedDefines a human readable text alternative of aria-colindex.
aria-colspannumber | undefinedDefines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
aria-controlsstring | undefinedIdentifies the element (or elements) whose contents or presence are controlled by the current element.
aria-currentboolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefinedIndicates the element that represents the current item within a container or set of related elements.
aria-describedbystring | undefinedIdentifies the element (or elements) that describes the object.
aria-descriptionstring | undefinedDefines a string value that describes or annotates the current element.
aria-detailsstring | undefinedIdentifies the element that provides a detailed, extended description for the object.
aria-disabledBooleanish | undefinedIndicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
aria-dropeffect"link" | "none" | "copy" | "execute" | "move" | "popup" | undefinedIndicates what functions can be performed when a dragged object is released on the drop target.
aria-errormessagestring | undefinedIdentifies the element that provides an error message for the object.
aria-expandedBooleanish | undefinedIndicates whether the element, or another grouping element it controls, is currently expanded or collapsed.
aria-flowtostring | undefinedIdentifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, allows assistive technology to override the general default of reading in document source order.
aria-grabbedBooleanish | undefinedIndicates an element's "grabbed" state in a drag-and-drop operation.
aria-haspopupboolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefinedIndicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
aria-hiddenBooleanish | undefinedIndicates whether the element is exposed to an accessibility API.
aria-invalidboolean | "true" | "false" | "grammar" | "spelling" | undefinedIndicates the entered value does not conform to the format expected by the application.
aria-keyshortcutsstring | undefinedIndicates keyboard shortcuts that an author has implemented to activate or give focus to an element.
aria-labelstring | undefinedDefines a string value that labels the current element.
aria-labelledbystring | undefinedIdentifies the element (or elements) that labels the current element.
aria-levelnumber | undefinedDefines the hierarchical level of an element within a structure.
aria-live"off" | "assertive" | "polite" | undefinedIndicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.
aria-modalBooleanish | undefinedIndicates whether an element is modal when displayed.
aria-multilineBooleanish | undefinedIndicates whether a text box accepts multiple lines of input or only a single line.
aria-multiselectableBooleanish | undefinedIndicates that the user may select more than one item from the current selectable descendants.
aria-orientation"horizontal" | "vertical" | undefinedIndicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.
aria-ownsstring | undefinedIdentifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
aria-placeholderstring | undefinedDefines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format.
aria-posinsetnumber | undefinedDefines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
aria-pressedboolean | "true" | "false" | "mixed" | undefinedIndicates the current "pressed" state of toggle buttons.
aria-readonlyBooleanish | undefinedIndicates that the element is not editable, but is otherwise operable.
aria-relevant"text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefinedIndicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
aria-requiredBooleanish | undefinedIndicates that user input is required on the element before a form may be submitted.
aria-roledescriptionstring | undefinedDefines a human-readable, author-localized description for the role of an element.
aria-rowcountnumber | undefinedDefines the total number of rows in a table, grid, or treegrid.
aria-rowindexnumber | undefinedDefines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
aria-rowindextextstring | undefinedDefines a human readable text alternative of aria-rowindex.
aria-rowspannumber | undefinedDefines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
aria-selectedBooleanish | undefinedIndicates the current "selected" state of various widgets.
aria-setsizenumber | undefinedDefines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
aria-sort"none" | "ascending" | "descending" | "other" | undefinedIndicates if items in a table or grid are sorted in ascending or descending order.
aria-valuemaxnumber | undefinedDefines the maximum allowed value for a range widget.
aria-valueminnumber | undefinedDefines the minimum allowed value for a range widget.
aria-valuenownumber | undefinedDefines the current value for a range widget.
aria-valuetextstring | undefinedDefines the human readable text alternative of aria-valuenow for a range widget.
autoCapitalize"off" | "none" | "on" | "sentences" | "words" | "characters" | (string & {}) | undefined
autoCorrectstring | undefined
autoFocusboolean | undefined
autoSavestring | undefined
childrenstring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode> | null | undefined
classNamestring | undefined
contentstring | undefined
contentEditableBooleanish | "inherit" | "plaintext-only" | undefined
contextMenustring | undefined
dangerouslySetInnerHTML{ __html: string | TrustedHTML; } | undefined
datatypestring | undefined
defaultCheckedboolean | undefined
defaultValuestring | number | readonly string[] | undefined
dirstring | undefined
draggableBooleanish | undefined
enterKeyHint"search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined
exportpartsstring | undefined
hiddenboolean | undefined
idstring | undefined
inertboolean | undefined
inlistany
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefinedHints at the type of data that might be entered by the user while editing the element or its contents
isstring | undefinedSpecify that a standard HTML element should behave like a defined custom built-in element
itemIDstring | undefined
itemPropstring | undefined
itemRefstring | undefined
itemScopeboolean | undefined
itemTypestring | undefined
keyKey | null | undefined
langstring | undefined
noncestring | undefined
onAbortReactEventHandler<HTMLElement> | undefined
onAbortCaptureReactEventHandler<HTMLElement> | undefined
onAnimationEndAnimationEventHandler<HTMLElement> | undefined
onAnimationEndCaptureAnimationEventHandler<HTMLElement> | undefined
onAnimationIterationAnimationEventHandler<HTMLElement> | undefined
onAnimationIterationCaptureAnimationEventHandler<HTMLElement> | undefined
onAnimationStartAnimationEventHandler<HTMLElement> | undefined
onAnimationStartCaptureAnimationEventHandler<HTMLElement> | undefined
onAuxClickMouseEventHandler<HTMLElement> | undefined
onAuxClickCaptureMouseEventHandler<HTMLElement> | undefined
onBeforeInputInputEventHandler<HTMLElement> | undefined
onBeforeInputCaptureInputEventHandler<HTMLElement> | undefined
onBeforeToggleToggleEventHandler<HTMLElement> | undefined
onBlurFocusEventHandler<HTMLElement> | undefined
onBlurCaptureFocusEventHandler<HTMLElement> | undefined
onCanPlayReactEventHandler<HTMLElement> | undefined
onCanPlayCaptureReactEventHandler<HTMLElement> | undefined
onCanPlayThroughReactEventHandler<HTMLElement> | undefined
onCanPlayThroughCaptureReactEventHandler<HTMLElement> | undefined
onChangeChangeEventHandler<HTMLElement, Element> | undefined
onChangeCaptureChangeEventHandler<HTMLElement, Element> | undefined
onClickMouseEventHandler<HTMLElement> | undefined
onClickCaptureMouseEventHandler<HTMLElement> | undefined
onCompositionEndCompositionEventHandler<HTMLElement> | undefined
onCompositionEndCaptureCompositionEventHandler<HTMLElement> | undefined
onCompositionStartCompositionEventHandler<HTMLElement> | undefined
onCompositionStartCaptureCompositionEventHandler<HTMLElement> | undefined
onCompositionUpdateCompositionEventHandler<HTMLElement> | undefined
onCompositionUpdateCaptureCompositionEventHandler<HTMLElement> | undefined
onContextMenuMouseEventHandler<HTMLElement> | undefined
onContextMenuCaptureMouseEventHandler<HTMLElement> | undefined
onCopyClipboardEventHandler<HTMLElement> | undefined
onCopyCaptureClipboardEventHandler<HTMLElement> | undefined
onCutClipboardEventHandler<HTMLElement> | undefined
onCutCaptureClipboardEventHandler<HTMLElement> | undefined
onDoubleClickMouseEventHandler<HTMLElement> | undefined
onDoubleClickCaptureMouseEventHandler<HTMLElement> | undefined
onDragDragEventHandler<HTMLElement> | undefined
onDragCaptureDragEventHandler<HTMLElement> | undefined
onDragEndDragEventHandler<HTMLElement> | undefined
onDragEndCaptureDragEventHandler<HTMLElement> | undefined
onDragEnterDragEventHandler<HTMLElement> | undefined
onDragEnterCaptureDragEventHandler<HTMLElement> | undefined
onDragExitDragEventHandler<HTMLElement> | undefined
onDragExitCaptureDragEventHandler<HTMLElement> | undefined
onDragLeaveDragEventHandler<HTMLElement> | undefined
onDragLeaveCaptureDragEventHandler<HTMLElement> | undefined
onDragOverDragEventHandler<HTMLElement> | undefined
onDragOverCaptureDragEventHandler<HTMLElement> | undefined
onDragStartDragEventHandler<HTMLElement> | undefined
onDragStartCaptureDragEventHandler<HTMLElement> | undefined
onDropDragEventHandler<HTMLElement> | undefined
onDropCaptureDragEventHandler<HTMLElement> | undefined
onDurationChangeReactEventHandler<HTMLElement> | undefined
onDurationChangeCaptureReactEventHandler<HTMLElement> | undefined
onEmptiedReactEventHandler<HTMLElement> | undefined
onEmptiedCaptureReactEventHandler<HTMLElement> | undefined
onEncryptedReactEventHandler<HTMLElement> | undefined
onEncryptedCaptureReactEventHandler<HTMLElement> | undefined
onEndedReactEventHandler<HTMLElement> | undefined
onEndedCaptureReactEventHandler<HTMLElement> | undefined
onErrorReactEventHandler<HTMLElement> | undefined
onErrorCaptureReactEventHandler<HTMLElement> | undefined
onFocusFocusEventHandler<HTMLElement> | undefined
onFocusCaptureFocusEventHandler<HTMLElement> | undefined
onGotPointerCapturePointerEventHandler<HTMLElement> | undefined
onGotPointerCaptureCapturePointerEventHandler<HTMLElement> | undefined
onInputInputEventHandler<HTMLElement> | undefined
onInputCaptureInputEventHandler<HTMLElement> | undefined
onInvalidReactEventHandler<HTMLElement> | undefined
onInvalidCaptureReactEventHandler<HTMLElement> | undefined
onKeyDownKeyboardEventHandler<HTMLElement> | undefined
onKeyDownCaptureKeyboardEventHandler<HTMLElement> | undefined
onKeyPressKeyboardEventHandler<HTMLElement> | undefined
onKeyPressCaptureKeyboardEventHandler<HTMLElement> | undefined
onKeyUpKeyboardEventHandler<HTMLElement> | undefined
onKeyUpCaptureKeyboardEventHandler<HTMLElement> | undefined
onLoadReactEventHandler<HTMLElement> | undefined
onLoadCaptureReactEventHandler<HTMLElement> | undefined
onLoadedDataReactEventHandler<HTMLElement> | undefined
onLoadedDataCaptureReactEventHandler<HTMLElement> | undefined
onLoadedMetadataReactEventHandler<HTMLElement> | undefined
onLoadedMetadataCaptureReactEventHandler<HTMLElement> | undefined
onLoadStartReactEventHandler<HTMLElement> | undefined
onLoadStartCaptureReactEventHandler<HTMLElement> | undefined
onLostPointerCapturePointerEventHandler<HTMLElement> | undefined
onLostPointerCaptureCapturePointerEventHandler<HTMLElement> | undefined
onMouseDownMouseEventHandler<HTMLElement> | undefined
onMouseDownCaptureMouseEventHandler<HTMLElement> | undefined
onMouseEnterMouseEventHandler<HTMLElement> | undefined
onMouseLeaveMouseEventHandler<HTMLElement> | undefined
onMouseMoveMouseEventHandler<HTMLElement> | undefined
onMouseMoveCaptureMouseEventHandler<HTMLElement> | undefined
onMouseOutMouseEventHandler<HTMLElement> | undefined
onMouseOutCaptureMouseEventHandler<HTMLElement> | undefined
onMouseOverMouseEventHandler<HTMLElement> | undefined
onMouseOverCaptureMouseEventHandler<HTMLElement> | undefined
onMouseUpMouseEventHandler<HTMLElement> | undefined
onMouseUpCaptureMouseEventHandler<HTMLElement> | undefined
onPasteClipboardEventHandler<HTMLElement> | undefined
onPasteCaptureClipboardEventHandler<HTMLElement> | undefined
onPauseReactEventHandler<HTMLElement> | undefined
onPauseCaptureReactEventHandler<HTMLElement> | undefined
onPlayReactEventHandler<HTMLElement> | undefined
onPlayCaptureReactEventHandler<HTMLElement> | undefined
onPlayingReactEventHandler<HTMLElement> | undefined
onPlayingCaptureReactEventHandler<HTMLElement> | undefined
onPointerCancelPointerEventHandler<HTMLElement> | undefined
onPointerCancelCapturePointerEventHandler<HTMLElement> | undefined
onPointerDownPointerEventHandler<HTMLElement> | undefined
onPointerDownCapturePointerEventHandler<HTMLElement> | undefined
onPointerEnterPointerEventHandler<HTMLElement> | undefined
onPointerLeavePointerEventHandler<HTMLElement> | undefined
onPointerMovePointerEventHandler<HTMLElement> | undefined
onPointerMoveCapturePointerEventHandler<HTMLElement> | undefined
onPointerOutPointerEventHandler<HTMLElement> | undefined
onPointerOutCapturePointerEventHandler<HTMLElement> | undefined
onPointerOverPointerEventHandler<HTMLElement> | undefined
onPointerOverCapturePointerEventHandler<HTMLElement> | undefined
onPointerUpPointerEventHandler<HTMLElement> | undefined
onPointerUpCapturePointerEventHandler<HTMLElement> | undefined
onProgressReactEventHandler<HTMLElement> | undefined
onProgressCaptureReactEventHandler<HTMLElement> | undefined
onRateChangeReactEventHandler<HTMLElement> | undefined
onRateChangeCaptureReactEventHandler<HTMLElement> | undefined
onResetReactEventHandler<HTMLElement> | undefined
onResetCaptureReactEventHandler<HTMLElement> | undefined
onScrollUIEventHandler<HTMLElement> | undefined
onScrollCaptureUIEventHandler<HTMLElement> | undefined
onScrollEndUIEventHandler<HTMLElement> | undefined
onScrollEndCaptureUIEventHandler<HTMLElement> | undefined
onSeekedReactEventHandler<HTMLElement> | undefined
onSeekedCaptureReactEventHandler<HTMLElement> | undefined
onSeekingReactEventHandler<HTMLElement> | undefined
onSeekingCaptureReactEventHandler<HTMLElement> | undefined
onSelectReactEventHandler<HTMLElement> | undefined
onSelectCaptureReactEventHandler<HTMLElement> | undefined
onStalledReactEventHandler<HTMLElement> | undefined
onStalledCaptureReactEventHandler<HTMLElement> | undefined
onSubmitSubmitEventHandler<HTMLElement> | undefined
onSubmitCaptureSubmitEventHandler<HTMLElement> | undefined
onSuspendReactEventHandler<HTMLElement> | undefined
onSuspendCaptureReactEventHandler<HTMLElement> | undefined
onTimeUpdateReactEventHandler<HTMLElement> | undefined
onTimeUpdateCaptureReactEventHandler<HTMLElement> | undefined
onToggleToggleEventHandler<HTMLElement> | undefined
onTouchCancelTouchEventHandler<HTMLElement> | undefined
onTouchCancelCaptureTouchEventHandler<HTMLElement> | undefined
onTouchEndTouchEventHandler<HTMLElement> | undefined
onTouchEndCaptureTouchEventHandler<HTMLElement> | undefined
onTouchMoveTouchEventHandler<HTMLElement> | undefined
onTouchMoveCaptureTouchEventHandler<HTMLElement> | undefined
onTouchStartTouchEventHandler<HTMLElement> | undefined
onTouchStartCaptureTouchEventHandler<HTMLElement> | undefined
onTransitionCancelTransitionEventHandler<HTMLElement> | undefined
onTransitionCancelCaptureTransitionEventHandler<HTMLElement> | undefined
onTransitionEndTransitionEventHandler<HTMLElement> | undefined
onTransitionEndCaptureTransitionEventHandler<HTMLElement> | undefined
onTransitionRunTransitionEventHandler<HTMLElement> | undefined
onTransitionRunCaptureTransitionEventHandler<HTMLElement> | undefined
onTransitionStartTransitionEventHandler<HTMLElement> | undefined
onTransitionStartCaptureTransitionEventHandler<HTMLElement> | undefined
onVolumeChangeReactEventHandler<HTMLElement> | undefined
onVolumeChangeCaptureReactEventHandler<HTMLElement> | undefined
onWaitingReactEventHandler<HTMLElement> | undefined
onWaitingCaptureReactEventHandler<HTMLElement> | undefined
onWheelWheelEventHandler<HTMLElement> | undefined
onWheelCaptureWheelEventHandler<HTMLElement> | undefined
partstring | undefined
popover"" | "auto" | "manual" | "hint" | undefined
popoverTargetstring | undefined
popoverTargetAction"toggle" | "show" | "hide" | undefined
prefixstring | undefined
propertystring | undefined
radioGroupstring | undefined
refRef<HTMLElement> | undefinedAllows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).
relstring | undefined
resourcestring | undefined
resultsnumber | undefined
revstring | undefined
roleAriaRole | undefined
securitystring | undefined
slotstring | undefined
spellCheckBooleanish | undefined
stickyboolean | undefined
style({ [key: `--${string}`]: string | number; } & CSSProperties) | undefined
suppressContentEditableWarningboolean | undefined
suppressHydrationWarningboolean | undefined
tabIndexnumber | undefined
titlestring | undefined
translate"yes" | "no" | undefined
typeofstring | undefined
unselectable"off" | "on" | undefined
vocabstring | undefined

Accessibility

  • Make sure Header.Logo's child has accessible text. An icon-only logo needs an aria-label or visually-hidden text.
  • Inside Header.Menu, prefer real anchor elements (<a>, <Link>) over click-only buttons so the URL is real and the page is bookmarkable.

Related