b-nav-item-dropdown active state
See original GitHub issueIn Bootstrap NavBar, an active class can be set on the a
tag which is a direct sibling of the li
tag in order to mark the dropdown as active (indicating that any of its sibling pages is currently in view). See image below
Notice the Lang
dropdown? The rendered markup is provided below
<li class="nav-item b-nav-dropdown dropdown">
<a
href="#"
aria-haspopup="true"
aria-expanded="false"
class="nav-link dropdown-toggle active"
>
<span>Lang</span>
</a>
<div
tabindex="-1"
class="dropdown-menu dropdown-menu-right"
aria-labelledby="__BVID__212__BV_button_"
>
<a role="menuitem" target="_self" href="#" class="dropdown-item">EN</a>
<a role="menuitem" target="_self" href="#" class="dropdown-item">ES</a>
<a role="menuitem" target="_self" href="#" class="dropdown-item">RU</a>
<a role="menuitem" target="_self" href="#" class="dropdown-item">FA</a>
</div>
</li>
How can this same behaviour be replicated using Bootstrap-Vue? Because I don’t see this anywhere in the docs.
<b-nav-item-dropdown text="Profile" right>
<b-dropdown-item :to="{ name: 'Timeline' }">
Timeline
</b-dropdown-item>
<b-dropdown-item :to="{ name: 'Edit' }">Edit</b-dropdown-item>
</b-nav-item-dropdown>
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Nav | Components - BootstrapVue
Navigation components that share general markup and styles, from the base class to the active and disabled states. Swap modifier props to switch...
Read more >Bootstrap navbar Active State not working - Stack Overflow
I use the class="active" on my navbar and it does not switch when I press menu items. I know how to do this...
Read more >Navs - Bootstrap
Base nav. Navigation available in Bootstrap share general markup and styles, from the base .nav class to the active and disabled states. Swap...
Read more >how to highlight active nav-item? - Material Design for Bootstrap
The routerLinkActive directive should update the active state of the element also when you click on a specific link. You can use (click)...
Read more >Bootstrap dropdowns - CoreUI
Opt into darker dropdowns to match a dark navbar or custom style by adding ... Add .active to items in the dropdown to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
🙂
:extra-toggle-classes
was scrapped, now:toggle-class
is props instead of implementing ternary expressionsThanks for your quick response. For future reference, this was what worked for me
This [
extra-toggle-classes="$route.name === 'foobar' ? 'active' : '"
] applied all the text as a class attribute.But then, if more
b-dropdown-items
are added, this would become unwieldy as I would need to check for each route name. Is there a way to have an inclusive match that would apply the active class for any route under that dropdown? I set-up the routes like so/b-nav-item-dropdown/b-dropdown-item
.Once again, thanks for your time.