question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support custom HTML as dropdown trigger

See original GitHub issue

Currently I’m using this normal bootstrap code to achieve a dropdown navbar brand:

<nav class="navbar navbar-expand-md fixed-top">
    <div class="container">
      <nav class="navbar-nav">
        <li class="nav-item dropdown">
         
         //!!! Not supported !!!
          <a class="nav-link dropdown-toggle navbar-brand" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
            <img src="../assets/img/org-image.svg"/>
            <span class="headline">Some Org</span>
            <font-awesome-icon :icon="['fas', 'chevron-down']" :fixed-width="true"/>
          </a>

          <div class="dropdown-menu">
            <a class="dropdown-item" href="#">Action</a>
            <a class="dropdown-item" href="#">Another action</a>
            <a class="dropdown-item" href="#">Something else here</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" href="#">Separated link</a>
          </div>
        </li>
      </nav>

      <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar_collapse" aria-controls="navbar_collapse" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>

      <div class="collapse navbar-collapse" id="navbar_collapse">
        <ul class="navbar-nav mr-auto">
          <slot></slot>
        </ul>
      </div>
    </div>
  </nav>

This is not possible with bootstrap-vue since the dropdown only supports a text option and not custom html to be the trigger.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
tmorehousecommented, Nov 22, 2018

you can place custom content in the dropdown trigger. the nav dropdown inherits from b-dropdown.

use the slot button-content

<b-nav pills>
  <b-nav-item active>Active</b-nav-item>
  <b-nav-item>Link</b-nav-item>
  <b-nav-item-dropdown id="nav7_ddown" right>
   <template slot="button-content">custom <b>text</b></template>
   <b-dropdown-item>one</b-dropdown-item>
    <b-dropdown-item>two</b-dropdown-item>
    <b-dropdown-divider></b-dropdown-divider>
    <b-dropdown-item>three</b-dropdown-item>
  </b-nav-item-dropdown>
</b-nav>
0reactions
NathanWailescommented, Nov 22, 2018

Thank you, it worked perfectly!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Create a Custom Select Dropdown using HTML, CSS ...
A post on how to create a custom select dropdown using HTML, CSS and JavaScript. Should you build it from scratch or use...
Read more >
Trigger Custom Dropdown w/ jQuery - Stack Overflow
Trigger Custom Dropdown w/ jQuery · First you lay out your HTML "select" (dropdown) markup · (After including all necessary project files) You...
Read more >
Striking a Balance Between Native and Custom Select Elements
Clicking outside the component closes the listbox. The trigger contains a small triangle icon pointing downward to indicate there are options.
Read more >
How To Create Custom Select Menus - W3Schools
Create a Custom Select Menu. Step 1) Add HTML: Example. <!-- Surround the select box within a "custom-select" ...
Read more >
How to Create an HTML Dropdown Menu [+ Examples]
HTML Dropdown Menu ... A drop-down menu is a list of options that is revealed only when a user interacts with the menu,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found