How to remove caret from dropdown nav item in React Bootstrap
Asked Answered
M

2

6

I have been trying to remove the caret from the NavDropdown component with bootstrap 4 and react, however I have had no luck. This is my react and css, not sure what's going wrong. Thanks.

<Navbar expand="lg">
        <Navbar.Toggle aria-controls="basic-navbar-nav" />
        <Navbar.Collapse id="basic-navbar-nav">
          <Nav className="mr-auto">
          <NavDropdown title="ENGAGEMENT" id="basic-nav-dropdown" show={false} className="noCaret">
              <NavDropdown.Item href="#action/3.1">Action</NavDropdown.Item>
              <NavDropdown.Item href="#action/3.2">Another action</NavDropdown.Item>
              <NavDropdown.Item href="#action/3.3">Something</NavDropdown.Item>
              <NavDropdown.Divider />
              <NavDropdown.Item href="#action/3.4">Separated link</NavDropdown.Item>
            </NavDropdown>
          </Nav>
        </Navbar.Collapse> 
</Navbar>
.caret {
  display: none !important;
}

.navbar .dropdown-menu:after{
  display:none !important;
 }

 .dropdown-toggle.noCaret:after {
  display: none !important;
Maebashi answered 14/4, 2020 at 20:35 Comment(0)
M
9

You can disable the caret by using id as well

 #dropdown-basic::after{
      display: none; 
   }
Merited answered 12/7, 2020 at 20:48 Comment(0)
H
5

This works for me, using default bootstrap classes.

    .dropdown-toggle::after {
      display: none;
    }
Hypercorrect answered 7/9, 2021 at 9:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.