Skip to content

Club buttons in a drop down – m2 admin

I have created buttons for a page in m2 admin. Please see below screenshot.

enter image description here

I’ve used following xml code at /view/adminhtml/ui_component/buttons.xml:

    <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <argument name="data" xsi:type="array">
 <item name="buttons" xsi:type="array">
            <item name="addAllProductsForSync" xsi:type="array">
                <item name="name" xsi:type="string">addAllProductsForSync</item>
                <item name="label" xsi:type="string" translate="true">Add all Products For Sync</item>
                <item name="class" xsi:type="string">primary</item>
                <item name="url" xsi:type="string">*/*/addAllProductsForSync</item>
            </item>
            <item name="EnqueueAllInProgress" xsi:type="array">
                <item name="name" xsi:type="string">EnqueueAllInProgress</item>
                <item name="label" xsi:type="string" translate="true">Enqueue All In Progress</item>
                <item name="class" xsi:type="string">primary</item>
                <item name="url" xsi:type="string">*/*/backToQueue</item>
            </item>
            <item name="clearQueue" xsi:type="array">
                <item name="name" xsi:type="string">clear</item>
                <item name="label" xsi:type="string" translate="true">Clear Queue</item>
                <item name="class" xsi:type="string">primary</item>
                <item name="url" xsi:type="string">*/*/clear</item>
            </item>
            <item name="clearEntities" xsi:type="array">
                <item name="name" xsi:type="string">clear</item>
                <item name="label" xsi:type="string" translate="true">Clear Entities Sync</item>
                <item name="class" xsi:type="string">primary</item>
                <item name="url" xsi:type="string">*/*/clearentities</item>
            </item>
            <item name="truncateQueue" xsi:type="array">
                <item name="name" xsi:type="string">truncate</item>
                <item name="label" xsi:type="string" translate="true">Truncate Queue</item>
                <item name="class" xsi:type="string">primary</item>
                <item name="url" xsi:type="string">*/*/truncate</item>
            </item>
        </item>
    </argument>
</listing>

As you see, buttons are taking much space. So, can I club them into a drop down or something similar without break the existing functionality?

Your help would be appreciated. Thank you!