feat(v2): nav dropdown (#2487)

* feat(v2): allow nav dropdown

* docs(v2): document navbar links

* fix bug
This commit is contained in:
Yangshun Tay 2020-04-01 03:10:04 +08:00 committed by GitHub
parent 054563befe
commit f96c2b61d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 108 additions and 40 deletions

View file

@ -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.