// Set up the navbar items
{% set navbar_items %}
{% include '@bolt-components-navbar/navbar-li.twig' with {
link: {
content: 'Section 1',
attributes: {
href: '#section-1'
}
}
} only %}
...
{% endset %}
{% set navbar_list %}
{% include '@bolt-components-navbar/navbar-ul.twig' with {
content: navbar_items,
} only %}
{% endset %}
// Pass the navbar items to the navbar template
{% include '@bolt-components-navbar/navbar.twig' with {
title: {
content: 'This is the navbar title',
icon: {
name: 'marketing-gray'
},
link: {
attributes: {
href: 'https://pega.com'
},
},
},
links: navbar_list
} only %}
kebab-case
.
Prop Name | Description | Type | Default Value | Option(s) |
---|---|---|---|---|
title
|
Navbar title. Icon is optional. Tag can be set to h1 to h6 depending on the page. |
object
| — |
|
links
|
Content of navbar links. Navbar ul is expected here. |
any
| — |
|
content
|
Custom navbar content. Content provided here will replace title and links. |
any
| — |
|
spacing
|
Controls the inset spacing of the navbar |
string
|
small
|
|
width
|
Control the width of the navbar. Full will span the entire screen width ignoring any wrapper or page max-width. |
string
|
full
|
|
center
|
Determines if you want the Navbar content to be center aligned or not |
boolean
|
false
|
|
static
|
Set the navbar to be static instead of sticky. |
boolean
|
false
|
|
theme
|
Color theme. Can be set to 'none' for a transparent background. |
string
|
dark
|
|
offset
|
Number of pixels taken up by sticky items at the top of the page, used for smooth scroll. |
integer
| — |
|
sticky_offset
|
Offset the top position of the navbar by a specific pixel value. Only works when Navbar is sticky. |
integer
| — |
|
sticky_offset_selector
|
Offset the top position of the navbar by the height of a specific element or elements, which the selector points to. Selector can match multiple elements, uses the cumulative height. Must be a valid CSS selector. |
string
| — |
|
scroll_offset
|
Ofset the top position of a page section anchor by a specific pixel value. |
integer
| — |
|
uuid
|
Unique ID for the navbar, randomly generated if not provided. |
string
| — |
|
Prop Name | Description | Type | Default Value | Option(s) |
---|---|---|---|---|
attributes
|
A Drupal attributes object. Applies extra HTML attributes to the parent element. |
object
| — |
|
content
*
|
Content of navbar ul. Navbar li are expected here. |
any
| — |
|
Prop Name | Description | Type | Default Value | Option(s) |
---|---|---|---|---|
attributes
|
A Drupal attributes object. Applies extra HTML attributes to the parent element. |
object
| — |
|
link
*
|
Link of the navbar item. Pass a hash to the "href" attribute to link to an in-page section. |
object
| — |
|
current
|
Automatically mark a navbar link as current |
boolean
| — |
|
npm install @bolt/components-navbar
spacing
prop to xsmall
when using the center
prop.
theme
prop is set to none
, the navbar will have a transparent background.sticky_offset_selector
.sticky_offset_selector
can automatically calculate the dynamic height of a specific element, the sticky_offset
can offset a specific pixel value manually. You may choose to use that instead if you need an absolute value. Ideally, the two props are not used in tandem.content
prop completely overrides the title
and links
props.