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

pawled free asked 1 year ago

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

Bellmare free answered 2 months ago

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

joe829 free answered 4 months ago

If you add a link to the front page of a site and this can automatically direct you to your website. The resume prime can help in making dropdown links that direct to your front web page.

Dawid Wajszczuk staff answered 1 year ago


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

Keep coding,

pawled free commented 9 months ago

I meant navbar dropdown rather.

mlazaru staff commented 9 months ago

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

cloudsyte2 premium answered 1 year 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

  • User: 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