nav
The bar at the top of a page: brand, links, one call to action and a menu that needs no script.
{
"kind": "nav",
"shell": {
"inset": "bleed",
"density": "none",
"surface": "glass",
"sticky": true
},
"block": {
"type": "nav",
"menu": "none",
"brand": {
"href": "/",
"text": "Benchlist",
"mark": "layout-grid"
},
"links": [
[
"/city/duluth",
"Duluth"
],
[
"/about",
"About"
]
],
"cta": {
"href": "/list-a-bench",
"label": "List a bench"
},
"search": {
"action": "/city/duluth",
"placeholder": "Kiln, lathe, loom, press"
}
}
}
{
"title": "nav",
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "nav"
},
"menu": {
"type": "string",
"enum": [
"overlay",
"push"
]
},
"collapse": {
"anyOf": [
{
"type": "number",
"const": 820
},
{
"type": "number",
"const": 880
}
]
},
"brand": {
"type": "object",
"properties": {
"href": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"text": {
"type": "string",
"minLength": 1,
"maxLength": 16
},
"mark": {
"type": "string",
"enum": [
"activity",
"anchor",
"arrow-right",
"arrow-up-right",
"badge-check",
"bell",
"blocks",
"bot",
"check",
"chevron-down",
"chevron-left",
"chevron-right",
"clock",
"code",
"compass",
"copy",
"credit-card",
"database",
"file-code-2",
"file-text",
"files",
"film",
"fingerprint",
"gauge",
"git-commit-horizontal",
"globe",
"history",
"key-round",
"landmark",
"layers",
"layout-grid",
"library",
"link",
"list",
"map-pin",
"menu",
"message-square",
"mic",
"plug",
"radar",
"refresh-cw",
"search",
"shield-check",
"ship",
"shopping-cart",
"sliders-horizontal",
"sparkles",
"terminal",
"ticket",
"waves",
"webhook",
"x"
]
},
"suffix": {
"type": "string",
"minLength": 1,
"maxLength": 8
},
"tile": {
"type": "boolean"
}
},
"required": [
"href"
],
"additionalProperties": false
},
"links": {
"maxItems": 6,
"type": "array",
"items": {
"type": "array",
"prefixItems": [
{
"type": "string",
"minLength": 1,
"maxLength": 160
},
{
"type": "string",
"minLength": 1,
"maxLength": 20
}
],
"items": false,
"minItems": 2,
"maxItems": 2
}
},
"cta": {
"type": "object",
"properties": {
"href": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 24
}
},
"required": [
"href",
"label"
],
"additionalProperties": false
}
},
"required": [
"type",
"menu",
"collapse",
"brand",
"links"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "nav"
},
"menu": {
"type": "string",
"const": "none"
},
"brand": {
"type": "object",
"properties": {
"href": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"text": {
"type": "string",
"minLength": 1,
"maxLength": 16
},
"mark": {
"type": "string",
"enum": [
"activity",
"anchor",
"arrow-right",
"arrow-up-right",
"badge-check",
"bell",
"blocks",
"bot",
"check",
"chevron-down",
"chevron-left",
"chevron-right",
"clock",
"code",
"compass",
"copy",
"credit-card",
"database",
"file-code-2",
"file-text",
"files",
"film",
"fingerprint",
"gauge",
"git-commit-horizontal",
"globe",
"history",
"key-round",
"landmark",
"layers",
"layout-grid",
"library",
"link",
"list",
"map-pin",
"menu",
"message-square",
"mic",
"plug",
"radar",
"refresh-cw",
"search",
"shield-check",
"ship",
"shopping-cart",
"sliders-horizontal",
"sparkles",
"terminal",
"ticket",
"waves",
"webhook",
"x"
]
},
"suffix": {
"type": "string",
"minLength": 1,
"maxLength": 8
},
"tile": {
"type": "boolean"
}
},
"required": [
"href"
],
"additionalProperties": false
},
"links": {
"maxItems": 3,
"type": "array",
"items": {
"type": "array",
"prefixItems": [
{
"type": "string",
"minLength": 1,
"maxLength": 160
},
{
"type": "string",
"minLength": 1,
"maxLength": 20
}
],
"items": false,
"minItems": 2,
"maxItems": 2
}
},
"cta": {
"type": "object",
"properties": {
"href": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 24
}
},
"required": [
"href",
"label"
],
"additionalProperties": false
},
"search": {
"type": "object",
"properties": {
"action": {
"type": "string",
"minLength": 1,
"maxLength": 160
},
"placeholder": {
"type": "string",
"minLength": 1,
"maxLength": 40
},
"query": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"clear": {
"type": "string",
"minLength": 1,
"maxLength": 160
}
},
"required": [
"action",
"placeholder"
],
"additionalProperties": false
}
},
"required": [
"type",
"menu",
"brand",
"links"
],
"additionalProperties": false
}
]
}When to use
Put one nav at the top of every page of a Site. It holds the brand, up to six links and one call to action, and a budget of 96 units keeps them on one row at full width.
Choose menu: "none" for three links or fewer, or for a directory that needs a search field in the bar. Choose overlay or push when the links outgrow a phone: under the collapse width a link to #menu opens the menu, with no script.
Label each link with the noun a reader looks for: Pricing, Docs, Blog.
No neighbor does this job.
The record
{
"kind": "nav",
"shell": { "inset": "bleed", "density": "none", "surface": "glass", "sticky": true },
"block": {
"type": "nav",
"menu": "none",
"brand": { "href": "/", "text": "Benchlist", "mark": "layout-grid" },
"links": [
["/city/duluth", "Duluth"],
["/about", "About"]
],
"cta": { "href": "/list-a-bench", "label": "List a bench" },
"search": { "action": "/city/duluth", "placeholder": "Kiln, lathe, loom, press" }
}
}Smallest that parses
{
"type": "nav",
"menu": "none",
"brand": { "href": "/", "text": "Benchlist" },
"links": []
}Fields and bounds
From @mdxui/site@7.0.0-alpha.0. A count reads as min–max × item; a string bound is its maximum length in characters, and links its refusal.
menu: "overlay" | "push"
| Prop | Type and bound | Required |
|---|---|---|
menu | "overlay" | "push" | yes |
collapse | 820 | 880 | yes |
brand | object | yes |
brand.href | string ≤160 | yes |
brand.text | string ≤16 | no |
brand.mark | icon or mark name (52) | no |
brand.suffix | string ≤8 | no |
brand.tile | boolean | no |
links | 0–6 × [string ≤160, string ≤20] | yes |
cta | object | no |
cta.href | string ≤160 | yes |
cta.label | string ≤24 | yes |
menu: "none"
| Prop | Type and bound | Required |
|---|---|---|
menu | "none" | yes |
brand | object | yes |
brand.href | string ≤160 | yes |
brand.text | string ≤16 | no |
brand.mark | icon or mark name (52) | no |
brand.suffix | string ≤8 | no |
brand.tile | boolean | no |
links | 0–3 × [string ≤160, string ≤20] | yes |
cta | object | no |
cta.href | string ≤160 | yes |
cta.label | string ≤24 | yes |
search | object | no |
search.action | string ≤160 | yes |
search.placeholder | string ≤40 | yes |
search.query | string ≤120 | no |
search.clear | string ≤160 | no |
Variants and counts
The menu is the variant: none, overlay or push. The search field comes with none only.
One record in five Themes
Shells
In three Businesses
Carried by every Template. Seen on pages/benchlist/home.json, section 0.
Do and do not
{
"type": "nav",
"menu": "overlay",
"collapse": 880,
"brand": {
"href": "/sites/harbor/",
"text": "Harbor tides",
"mark": "waves"
},
"links": [
[
"/sites/harbor/pricing",
"Pricing and plans"
],
[
"/sites/harbor/integrations",
"Integrations"
],
[
"/sites/harbor/blog",
"The tide blog"
],
[
"/sites/harbor/contact",
"Harbor masters"
],
[
"/sites/harbor/terms",
"Terms of use"
],
[
… 9 more linesblockAccessibility
| Check, on the exemplar render | Limit | Now | Pass |
|---|---|---|---|
| Skipped heading levels | 0 | 0 | yes |
| Unnamed nav landmarks | 0 | 0 of 1 | yes |
| Scroll regions a keyboard cannot reach | 0 | 0 of 0 | yes |
| Copy controls that announce the result | all | 0 of 0 | yes |
| Images and icons with no text alternative | 0 | 0 | yes |
Text pairs below AA across the 5 Themes and every scheme they emit: 5. See Render checks.
- Landmark The nav renders the page
headerwith onenavnamed Primary inside it. A skip link tomaincomes first. - Heading level The bar carries no heading. The brand is a link home, never the
h1. - Focus order Tab runs skip link, brand, links in record order, then the call. Under the collapse width the menu link takes the place of the row.
Related
No neighbor does this job.