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.
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
Allowed inner blocks:
core/navigation-linkcore/searchcore/social-linkscore/page-listcore/spacercore/home-linkcore/iconcore/site-titlecore/site-logocore/navigation-submenucore/loginoutcore/buttons
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 |
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
Defined via the usesContext and providesContext properties in block.json.
Provides context:
textColor→ attributetextColorcustomTextColor→ attributecustomTextColorbackgroundColor→ attributebackgroundColorcustomBackgroundColor→ attributecustomBackgroundColoroverlayTextColor→ attributeoverlayTextColorcustomOverlayTextColor→ attributecustomOverlayTextColoroverlayBackgroundColor→ attributeoverlayBackgroundColorcustomOverlayBackgroundColor→ attributecustomOverlayBackgroundColorfontSize→ attributefontSizecustomFontSize→ attributecustomFontSizeshowSubmenuIcon→ attributeshowSubmenuIconsubmenuVisibility→ attributesubmenuVisibilityopenSubmenusOnClick→ attributeopenSubmenusOnClickstyle→ attributestylemaxNestingLevel→ attributemaxNestingLevel
This is a hybrid block. It saves static markup that the server may enhance during rendering.
<!-- wp:navigation -->
<!-- /wp:navigation -->- block.json (reference)
- Source directory — browse
edit.js,save.js,index.php, and more.
