Anatomy
Note: Image not to scale
- Trigger
- Container
- Links
Options
Trigger
Trigger a navigation menu with a call to action, such as a button, link, icon, or other control.
Position
The display position can be defined directionally based on the location of the trigger.
Behavior
Hover
A hover action changes the link color to $accessible
.
Active
Active state changes the link color to $accessible
, with a bold font weight.
Disabled
A disabled link appears as $disabled
.
Overflow
If only some of the content can be displayed in view, a max height can be defined and
overflow should be set to scroll
Accessibility
Keyboard controls
A Navigation Menu shows/hides without delay when the trigger is in focus and space/enter is selected on the keyboard. If the Navigation Menu is open and either shift+tab, or tab, is selected on the keyboard it will move focus to the next focusable element. When esc is selected on the keyboard, it will close the Navigation Menu and move the focus to the trigger.
Guidance
Avoid non-wayfinding content
A navigation menu is primarily reserved for links. It is not meant to communicate significant amounts of freeform or non-wayfinding content; consider a Popover or Tooltip instead.
API Reference
NavigationMenuRoot
Prop | Description | Type | Default | Required |
---|---|---|---|---|
children | Any React node may be used as a child to allow for formatting | enum ReactNode | ---- | False |
orientation | enum Orientation | ---- | False | |
dir | enum Direction | ---- | False | |
value | string | ---- | False | |
defaultValue | string | ---- | False | |
asChild | enum boolean | ---- | False | |
onValueChange | (value: string) => void | ---- | False | |
delayDuration | The duration from when the pointer enters the trigger until the tooltip gets opened. @defaultValue 200 | number | ---- | False |
skipDelayDuration | How much time a user has to enter another trigger without incurring a delay again. @defaultValue 300 | number | ---- | False |
css | WPDS provides a css prop for overriding styles easily. It’s like the style attribute, but it supports tokens, media queries, nesting and token-aware values. All WPDS Components include a css prop. Use it to pass in overrides. | CSS | ---- | False |
NavigationMenuList
Prop | Description | Type | Default | Required |
---|---|---|---|---|
children | Any React node may be used as a child to allow for formatting | enum ReactNode | ---- | False |
asChild | enum boolean | ---- | False | |
css | WPDS provides a css prop for overriding styles easily. It’s like the style attribute, but it supports tokens, media queries, nesting and token-aware values. All WPDS Components include a css prop. Use it to pass in overrides. | {} & { alignContent?: Globals | ScaleValue | Index | AlignContent; alignItems?: Globals | ScaleValue | Index | AlignItems; ... 425 more ...; vectorEffect?: Globals | ... 2 more ... | VectorEffect; } & ... 7 more ... & { ...; } | ---- | False |
NavigationMenuItem
Prop | Description | Type | Default | Required |
---|---|---|---|---|
children | Any React node may be used as a child to allow for formatting | enum ReactNode | ---- | False |
value | string | ---- | False | |
asChild | enum boolean | ---- | False | |
css | WPDS provides a css prop for overriding styles easily. It’s like the style attribute, but it supports tokens, media queries, nesting and token-aware values. All WPDS Components include a css prop. Use it to pass in overrides. | CSS | ---- | False |
NavigationMenuLink
Prop | Description | Type | Default | Required |
---|---|---|---|---|
children | Any React node may be used as a child to allow for formatting | enum ReactNode | ---- | False |
onSelect | (event: Event) => void | ---- | False | |
asChild | enum boolean | ---- | False | |
css | WPDS provides a css prop for overriding styles easily. It’s like the style attribute, but it supports tokens, media queries, nesting and token-aware values. All WPDS Components include a css prop. Use it to pass in overrides. | {} & { alignContent?: Globals | ScaleValue | Index | AlignContent; alignItems?: Globals | ScaleValue | Index | AlignItems; ... 425 more ...; vectorEffect?: Globals | ... 2 more ... | VectorEffect; } & ... 7 more ... & { ...; } | ---- | False |
active | enum boolean | ---- | False |
NavigationMenuTrigger
Prop | Description | Type | Default | Required |
---|---|---|---|---|
children | Any React node may be used as a child | enum ReactNode | ---- | False |
asChild | enum boolean | ---- | False | |
css | WPDS provides a css prop for overriding styles easily. It’s like the style attribute, but it supports tokens, media queries, nesting and token-aware values. All WPDS Components include a css prop. Use it to pass in overrides. | {} & { alignContent?: Globals | ScaleValue | Index | AlignContent; alignItems?: Globals | ScaleValue | Index | AlignItems; ... 425 more ...; vectorEffect?: Globals | ... 2 more ... | VectorEffect; } & ... 7 more ... & { ...; } | ---- | False |
NavigationMenuContent
Prop | Description | Type | Default | Required |
---|---|---|---|---|
children | Any React node may be used as a child to allow for formatting | enum ReactNode | ---- | False |
asChild | enum boolean | ---- | False | |
css | WPDS provides a css prop for overriding styles easily. It’s like the style attribute, but it supports tokens, media queries, nesting and token-aware values. All WPDS Components include a css prop. Use it to pass in overrides. | {} & { alignContent?: Globals | ScaleValue | Index | AlignContent; alignItems?: Globals | ScaleValue | Index | AlignItems; ... 425 more ...; vectorEffect?: Globals | ... 2 more ... | VectorEffect; } & ... 7 more ... & { ...; } | ---- | False |
disableOutsidePointerEvents | When `true`, hover/focus/click interactions will be disabled on elements outside the `DismissableLayer`. Users will need to click twice on outside elements to interact with them: once to close the `DismissableLayer`, and again to trigger the element. | enum boolean | ---- | False |
onEscapeKeyDown | Event handler called when the escape key is down. Can be prevented. | (event: KeyboardEvent) => void | ---- | False |
onPointerDownOutside | Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`. Can be prevented. | (event: PointerDownOutsideEvent) => void | ---- | False |
onFocusOutside | Event handler called when the focus moves outside of the `DismissableLayer`. Can be prevented. | (event: FocusOutsideEvent) => void | ---- | False |
onInteractOutside | Event handler called when an interaction happens outside the `DismissableLayer`. Specifically, when a `pointerdown` event happens outside or focus moves outside of it. Can be prevented. | (event: PointerDownOutsideEvent | FocusOutsideEvent) => void | ---- | False |
forceMount | Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. | true | ---- | False |
referenceElement | Trigger dom element used for positioning | HTMLButtonElement | ---- | False |
side | The preferred side of the trigger to render against when open. | enum bottom | left | right | top | bottom | False |
align | The preferred alignment against the anchor. | enum center | end | start | start | False |
popperOptions | Popper options object to pass to internal popper | Omit<Partial<Options>, "modifiers"> & { createPopper?: <TModifier extends Partial<Modifier<any, any>>>(reference: Element | VirtualElement, popper: HTMLElement, options?: Partial<...>) => Instance; modifiers?: readonly Partial<...>[]; } | ---- | False |
NavigationMenuSub
Prop | Description | Type | Default | Required |
---|---|---|---|---|
children | Any React node may be used as a child to allow for formatting | enum ReactNode | ---- | False |
orientation | enum Orientation | ---- | False | |
value | string | ---- | False | |
defaultValue | string | ---- | False | |
asChild | enum boolean | ---- | False | |
onValueChange | (value: string) => void | ---- | False | |
css | WPDS provides a css prop for overriding styles easily. It’s like the style attribute, but it supports tokens, media queries, nesting and token-aware values. All WPDS Components include a css prop. Use it to pass in overrides. | CSS | ---- | False |