Topic: MDBDropdownItem - what is the correct to add a Link to this without losing Formatting

Nates premium asked 5 years ago


Lessoon 03

THis does not work so I made this..

Lesson 01

However, this changes the CSS beacuse Link now becomes a and then messed up the formatting.

Also tried Lesson 01 Lesson 02

What should I do?


Aliaksandr Andrasiuk staff answered 5 years ago


Hello,

In order to use Link inside DropdownItem you can wrap it like this:

<MDBDropdownMenu>
            <Link to="/link"><MDBDropdownItem tag="span">Item</MDBDropdownItem></Link>
            <Link to="/anotherlink"><MDBDropdownItem tag="span">Item</MDBDropdownItem></Link>
             ...
</MDBDropdownMenu>

Best regards,

Aliaksandr from MDB.


Aliaksandr Andrasiuk staff answered 5 years ago


Hello,

Can you specify the problem, please?

If you want to use <MDBDropdownItem> as a link it's enough to add href property.

This should look like this:

<MDBDropdownItem href="https://mdbootstrap.com">Action</MDBDropdownItem>.

You can find more information in our documentation https://mdbootstrap.com/docs/react/components/dropdowns/.

Best regards,

Aliaksandr.


Nates premium commented 5 years ago

I am using {Router} and {Link} so I want to use to="" so that it routes without reloading the page.. how do I do this?

When I wrap a around the drop down it adds extra css


mark-steven-au premium commented 4 years ago

I have same question.What is the syntax to add the ACTUAL link on a drop down?The "more information page shows you all the many buttons etc but no examples of how to link to another component the React project EG another page in same folder or something like that. Page is already referenced etc in "Routes.js" page but does not work


Jakub Chmura staff commented 4 years ago

Hi, there is no possibility to use MDBDropdownItem as aLink from the react-router.

Please put router Link inside of MDBDropdownItem

Best, Kuba


Teeskid free commented 7 months ago

How about using router Link as the MDBDropdownItem tag attr.? The problem is that is does not then accept to attribute. Somebody help please.


Grzegorz Bujański staff commented 7 months ago

MDBDropdownItem does not have the to prop, you need to add Link as a child or wrapper for MDBDropdownItem


FREE CONSULTATION

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

Status

Closed

Specification of the issue

  • ForumUser: Premium
  • Premium support: Yes
  • Technology: MDB React
  • MDB Version: 4.11.1
  • Device: All
  • Browser: All
  • OS: Windows
  • Provided sample code: No
  • Provided link: No