0

I am new with Magento 2 and web development. I don't understand how to create dropdown button. I saw some style in below website and I am not sure how to use it.

http://www.bergo.nl/pub/static/frontend/Magento/blank/en_US/css/docs/dropdowns.html

I have button.phtml file in templates/product/view

And put the below code but It is not working.

<div class="example-dropdown-2">
<button class="action toggle"
        data-mage-init='{"dropdown":{}}'
        data-toggle="dropdown"
        aria-haspopup="true">
    <span>button + dropdown</span>
</button>
<ul class="dropdown">
    <li>
        <span class="item">One</span>
    </li>
    <li>
        <span class="item">Two</span>
    </li>
    <li>
        <span class="item">Three</span>
    </li>
</ul>

Does anyone know how to add dropdown and what would be the best practice to implement?

Thank you.

3
  • 1
    you want to create a custom button in custom pages or want to replace everywhere in website please let me know some more details on this so that i can help you out Commented Aug 23, 2020 at 13:56
  • Thank you for replying! I want to add custom button in product screen. I already generate new template in layout file and connecting to "button.phtml" and this page, I can see product detail and "add cart" function button and I want to add custom button dropdown in button.phtml file
    – clear.choi
    Commented Aug 23, 2020 at 15:10
  • Please check following link it may help you magento.stackexchange.com/questions/167160/… Commented Aug 23, 2020 at 16:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.