In the bootstrap official docs I have seen a cool nav pills set. This is it.
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<a class="nav-link active" id="v-pills-home-tab" data-toggle="pill" href="#v-pills-home" role="tab" aria-controls="v-pills-home" aria-selected="true">Home</a>
<a class="nav-link" id="v-pills-profile-tab" data-toggle="pill" href="#v-pills-profile" role="tab" aria-controls="v-pills-profile" aria-selected="false">Profile</a>
<a class="nav-link" id="v-pills-messages-tab" data-toggle="pill" href="#v-pills-messages" role="tab" aria-controls="v-pills-messages" aria-selected="false">Messages</a>
<a class="nav-link" id="v-pills-settings-tab" data-toggle="pill" href="#v-pills-settings" role="tab" aria-controls="v-pills-settings" aria-selected="false">Settings</a>
</div>
<div class="tab-content" id="v-pills-tabContent">
<div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">...</div>
<div class="tab-pane fade" id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab">...</div>
<div class="tab-pane fade" id="v-pills-messages" role="tabpanel" aria-labelledby="v-pills-messages-tab">...</div>
<div class="tab-pane fade" id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab">...</div>
</div>
and this is the code I currently using for navigation.
<ul class="nav flex-column">
<li class="nav-item">
<router-link to="/studentDashboard">Dashboard</router-link>
</li>
<li class="nav-item">
<router-link to="/buyPapers">Buy papers</router-link>
</li>
<li class="nav-item" >
<router-link to="/myPapers">My papers</router-link>
</li>
</ul>
What should I change to use that pills in this code?
<router-link> by defult is rendered as an achor tag `<a>`.
Bootstap 4 nav-pills have a <a>
tag with class nav-link
. as below:
<ul class="nav nav-pills">
<li class="nav-item">
<a class="nav-link active" href="#">Active</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
</li>
</ul>
So just add that class to your <router-link>
<li class="nav-item">
<router-link class="nav-link" active-class="active" to="/studentDashboard">Dashboard</router-link>
</li>
To add the active
class to the nav-pill that represents the current active route add active-class
prop on every `
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With