Topic: How to make a navbar dropdown-link active automatically?

pawled free asked 2 years ago

I wanna make dropdown-link active when any of its items is on. Same as in sidenav-link with collapsible content.

free answered 1 year ago

If you want your navbar dropdown-link to be active automatically, you can use the "active" class.

Dawid Wajszczuk staff answered 2 years ago


What @cloudsyte2 sent will get the job done. Here is the snippet with possible solution for MDB

Keep coding,

pawled free commented 2 years ago

I meant navbar dropdown rather.

Mateusz Lazaru staff commented 2 years ago

It does not have such option. We will consider adding it in future.

cloudsyte2 premium answered 2 years ago

This might help

Change the code according to your framework (js/react).

Also, what you need to do in a nutshell is, watch for the URL (window.location) and see if it is equal to your dropdown link route.

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.11.0
  • Device: Any
  • Browser: Any
  • OS: Any
  • Provided sample code: No
  • Provided link: No