mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-24 03:58:49 +02:00
feat(v2): nav dropdown (#2487)
* feat(v2): allow nav dropdown * docs(v2): document navbar links * fix bug
This commit is contained in:
parent
054563befe
commit
f96c2b61d7
5 changed files with 108 additions and 40 deletions
|
@ -98,9 +98,9 @@ module.exports = {
|
|||
navbar: {
|
||||
links: [
|
||||
{
|
||||
to: 'docs/docusaurus.config.js',
|
||||
label: 'docusaurus.config.js',
|
||||
position: 'left',
|
||||
to: 'docs/introduction',
|
||||
label: 'Introduction',
|
||||
position: 'left', // or 'right'
|
||||
// To apply the active class styling on all
|
||||
// routes starting with this path.
|
||||
activeBasePath: 'docs',
|
||||
|
@ -115,6 +115,38 @@ module.exports = {
|
|||
|
||||
Outbound links automatically get `target="_blank" rel="noopener noreferrer"` attributes.
|
||||
|
||||
### Navbar Dropdown
|
||||
|
||||
Navbar items can also be dropdown items by specifying the `items`, an inner array of navbar links.
|
||||
|
||||
```js {9-19} title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
...
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
links: [
|
||||
{
|
||||
label: 'Community',
|
||||
position: 'left', // or 'right'
|
||||
items: [
|
||||
{
|
||||
label: 'Facebook',
|
||||
href: '...',
|
||||
},
|
||||
{
|
||||
label: 'GitHub',
|
||||
href: '...',
|
||||
},
|
||||
// ... more items
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
...
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
### Auto-hide sticky navbar
|
||||
|
||||
You can enable this cool UI feature that automatically hides the navbar when a user starts scrolling down the page, and show it again when the user scrolls up.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue