I created a custom tab for customer edit page in backend like this:


<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> 
           <referenceBlock name="customer_form">
             <block class="Namespace\Module\Block\Adminhtml\Edit\Tab\Vcard" name="customer_edit_tab_vcard" >
              <action method="setTabLabel">
                  <argument name="label" xsi:type="string">V-Card</argument>

When i opened the customer edit page, the first tab that is active is Customer View


How can i set my custom tab that is active?

  • Do you mean you want set your custom tab as active by default when you edit any customer? – Sukumar Gorai Jun 19 '19 at 9:09
  • @SukumarGorai yes, to be precise i'll add get param to the url , when this get param exist in the url , my custom tab will be active – blue Jun 19 '19 at 9:12
  • So when you will get param from url then only your tab will show active. Is it correct? – Sukumar Gorai Jun 19 '19 at 9:13
  • @SukumarGorai yes that is correct , for example mage2.loc/admin/customer/index/edit/id/118/vcard/1/key/… , the param will be vcard – blue Jun 19 '19 at 9:25
  • @blue have u got a solution for this ? – chris Jun 20 '20 at 13:53

In Magento 2 backend forms, by default, the active tab is set based on which module loads first in the sequence.

If you check addTab method in Magento\Backend\Block\Widget\Tab\TabInterface\Tab class you will see that logic setup first added tab to active status if the active tab does not determine.

  • so how can i set my tab to be active? – blue Jun 19 '19 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.