174

I am using Bootstrap 4. I tried to remove the arrow in dropdown.

The answers I found for Bootstrap 3 do not work any more.

The jsfiddle is here.

<div class="dropdown open">
  <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Dropdown
  </button>
  <div class="dropdown-menu" aria-labelledby="dropdownMenu1">
    <a class="dropdown-item" href="#">Action</a>
    <a class="dropdown-item" href="#">Another action</a>
  </div>
</div>
Community
  • 1
  • 1
Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267

13 Answers13

298

Simply remove "dropdown-toggle" class from the element. The dropdown will still work if you have the data-toggle attribute as follows

<button role="button" type="button" class="btn" data-toggle="dropdown"> 
    Dropdown Without Arrow
</button>

overriding .dropdown-toggle class styles affects all dropdowns and you may want to keep the arrow in other buttons, that's why this looks to me the simplest solution.

Edit: Keep dropdown class if you want to keep border styling

<button role="button" type="button" class="btn dropdown" data-toggle="dropdown"> 
    Dropdown Without Arrow
</button>
Amal K
  • 4,359
  • 2
  • 22
  • 44
İlter Kağan Öcal
  • 3,530
  • 1
  • 17
  • 10
  • 3
    For some reason, the other solutions weren't working for me. I'm running Bootstrap 4. This was the only thing that worked. – anonymoose Dec 27 '17 at 00:47
  • 12
    This didn't quite work for me. The right side of the button is no longer rounded. – Jace Browning Jan 12 '18 at 01:49
  • Simpler than writing custom CSS with `!important` :) – hughjdavey Aug 13 '18 at 12:11
  • 2
    I tested this and it works pretty well! Tested in FF, Chrome, IE and Opera - even on mobile android devices with build-in browser no annoying arrow - thanks alot sir! NOTICE: don't remove the complete "dropdown-toggle" attribute, just remove the "-toggle" attribute, so your styling for the dropdownmenu don't get rid. So "dropdown-toggle" turns to "dropdown" - hope this helps. – Kerim Yagmurcu Mar 04 '19 at 19:46
  • This one is working for v5 very nicely. Thanks. – Sohan Arafat Sep 20 '21 at 00:35
147

With css, you could just do that:

.dropdown-toggle::after {
    display:none;
}
rybo111
  • 12,240
  • 4
  • 61
  • 70
Clyff
  • 4,046
  • 2
  • 17
  • 32
74

I don't recommend any of the existing answers because:

  • .dropdown-toggle has more styling than just the caret. Removing the class from the element causes styling issues.

  • Overriding .dropdown-toggle doesn't make sense. Just because you don't need a caret on some particular element, doesn't mean you won't need one later.

  • ::after doesn't cover dropdown variants (some use ::before).

Use a custom .caret-off in the same element as your .dropdown-toggle element:

.caret-off::before {
    display: none;
}
.caret-off::after {
    display: none;
}

Some have said they needed to add !important but YMMV.

rybo111
  • 12,240
  • 4
  • 61
  • 70
26

remove the dropdown-toggle class

Jochem
  • 3,295
  • 4
  • 30
  • 55
Abdullah Alkurdi
  • 378
  • 1
  • 5
  • 11
  • 8
    That's more like a comment – mrun Feb 01 '18 at 12:00
  • 3
    That is what [the accepted answer](https://stackoverflow.com/a/44577512/1364007) said six months before this one: "*Simply remove "dropdown-toggle" class from the element.*" – Wai Ha Lee Jul 27 '21 at 07:46
9
.dropdown-toggle::after { 
 content: none; 
 }

You can also try this

Epsi Vennila
  • 190
  • 3
  • 9
7

If you are interested in replacing the arrow with another Icon (such as, FontAwesome) you would just need to remove the border on the pseudo element of .dropdown-toggle

.dropdown-toggle::after { border: none; }
5

I was using the accepted answer for quite a while in my project but just now stumbled across a variable used by bootstrap:

$enable-caret: true !default;

If you set this to false then the caret will be removed without having to do any custom code.

My project was Ruby/Rails so I was using the bootstrap-rubygem. I changed the variable by importing a custom-variables.scss with the above variable set to false in my application.scss BEFORE the bootstrap.scss file/files.

bensmithbwd
  • 343
  • 3
  • 12
4

If you remove fit the dropdown-toggle class as below, all the dropdown buttons on your system will no longer have the caret.

.dropdown-toggle::after {
    display:none;
}

But maybe that's not what you want, so to remove just the specific button, we're going to insert a class called: remoecaret, and we'll fit the class: dropdown-toggle as follows:

.removecaret.dropdown-toggle::after {
    display: none;
}

and our html looks something like:

<div class="btn-group">
  <button class="btn btn-outline-secondary btn-sm dropdown-toggle removecaret" data-toggle="dropdown">
    <i class="fa fa-bars" aria-hidden="true"></i>
  </button>
  <ul class="dropdown-menu dropdown-menu-right">
    <li><a href="#"><a href="#"><i class="fa fa-cog" aria-hidden="true"></i>&nbsp;Edit</a></li>
  </ul>
</div>
krekto
  • 1,403
  • 14
  • 18
1

Boostrap generates this using the CSS border:

.dropdown-toggle:after {
  border: none;
}
aceofspades
  • 7,568
  • 1
  • 35
  • 48
1

If you wanna exactly only in this bootstrap button class, make:

.btn .dropdown-toggle::after {
    display:none;
}
S. zbr
  • 31
  • 2
0

have you tried tag="a" within the class? it hides the arrow without further css.

jerryurenaa
  • 3,863
  • 1
  • 27
  • 17
-1

Add no-arrow to drop-down toggle class declaration

-2

This works on bootsrap4 and ng-bootstrap.

.dropdown-toggle:after {
    display: none;
}
alvic
  • 288
  • 2
  • 5