The Navigation block is a container block for the collection of blocks that allow visitors to get around your site. See also the Navigation Link block and Navigation Submenu block.
CSS Classes
The structural CSS for the navigation block targets generic classnames across menu items of multiple types including those automatically generated by the Page List block. Here are some of the notable classnames and what they are used for:
.wp-block-navigation__submenu-containeris applied to submenus to main menu items..wp-block-navigation-itemis applied to every menu item..wp-block-navigation-item__contentis applied to the link inside a menu item..wp-block-navigation-item__labelis applied to the innermost container around the menu item text label..wp-block-navigation-item__descriptionis applied to the innermost container around the menu item description..wp-block-navigation__submenu-iconis applied to the submenu indicator (chevron).
A collection of blocks that allow visitors to get around your site.
- Name:
core/navigation - Category: theme
- API Version: 3
- Block Type: Hybrid (static save + server enhancements)
- Keywords:
menu,navigation,links
Block Relationships
Allowed inner blocks:
– core/navigation-link
– core/search
– core/social-links
– core/page-list
– core/spacer
– core/home-link
– core/icon
– core/site-title
– core/site-logo
– core/navigation-submenu
– core/loginout
– core/buttons
Attributes
Defined via the attributes property in block.json.
| Attribute | Type | Default | Description |
|---|---|---|---|
ref |
number |
— | — |
textColor |
string |
— | — |
customTextColor |
string |
— | — |
rgbTextColor |
string |
— | — |
backgroundColor |
string |
— | — |
customBackgroundColor |
string |
— | — |
rgbBackgroundColor |
string |
— | — |
showSubmenuIcon |
boolean |
true |
— |
submenuVisibility |
string |
"hover" |
Enum: hover, click, always |
overlayMenu |
string |
"mobile" |
— |
overlay |
string |
— | — |
icon |
string |
"handle" |
— |
hasIcon |
boolean |
true |
— |
__unstableLocation |
string |
— | — |
overlayBackgroundColor |
string |
— | — |
customOverlayBackgroundColor |
string |
— | — |
overlayTextColor |
string |
— | — |
customOverlayTextColor |
string |
— | — |
maxNestingLevel |
number |
5 |
— |
templateLock |
string \| boolean |
— | Enum: all, insert, contentOnly, false |
Supports
Defined via the supports property in block.json.
anchor:truealign:"wide","full"ariaLabel:truecontentRole:truehtml:falseinserter:truetypography:fontSize:truelineHeight:true
spacing:blockGap:trueunits:["px","em","rem","vh","vw"]
layout:allowSwitching:falseallowInheriting:falseallowVerticalAlignment:falseallowSizingOnChildren:truedefault:{"type":"flex"}
interactivity:truerenaming:false
Context
Defined via the usesContext and providesContext properties in block.json.
Provides context:
textColorattributetextColorcustomTextColorattributecustomTextColorbackgroundColorattributebackgroundColorcustomBackgroundColorattributecustomBackgroundColoroverlayTextColorattributeoverlayTextColorcustomOverlayTextColorattributecustomOverlayTextColoroverlayBackgroundColorattributeoverlayBackgroundColorcustomOverlayBackgroundColorattributecustomOverlayBackgroundColorfontSizeattributefontSizecustomFontSizeattributecustomFontSizeshowSubmenuIconattributeshowSubmenuIconsubmenuVisibilityattributesubmenuVisibilityopenSubmenusOnClickattributeopenSubmenusOnClickstyleattributestylemaxNestingLevelattributemaxNestingLevel
Block Markup
This is a hybrid block. It saves static markup that the server may enhance during rendering.
<!-- wp:navigation -->
<!-- /wp:navigation -->
Source
- block.json (reference)
- Source directory — browse
edit.js,save.js,index.php, and more.