nav
Information
- Folder
src/components/elements/nav
Files
Schema
$schema: http://json-schema.org/draft-07/schema
$id: /elements/nav
type: object
required:
- name
- label
- items
additionalProperties: false
properties:
name:
type: string
label:
type: string
items:
type: array
items:
type: object
required:
- text
- url
additionalProperties: false
properties:
text:
type: string
url:
type: string
active:
type: boolean
Mocks
name: ExampleNav
label: Example
items:
- text: Hello
url: /hello
active: true
- text: World
url: /world
- text: Foo
url: /foo
- text: Bar
url: /bar
Template
<nav
class="{{ name }}"
aria-label="{{ label }}"
>
<ul class="{{ name }}-list">
{% for item in items %}
<li class="{{ name }}-item">
<a
class="{{ name }}-link"
href="{{ item.url }}"
{% if item.active %}aria-current="page"{% endif %}
>
{{ item.text }}
</a>
</li>
{% endfor %}
</ul>
</nav>
Variants