How can I override a ui_components' template file?

The concerning file is:


I want to override this file so that it adds a CSS class to the div specific for the widget used.

I've tried copying the file to: app/design/frontend/Vendor/Theme/Magento_Ui/ui_component/templates/listing/default.xhtml

But this hasn't worked, even after flushing all caches and performing setup:upgrade I don't see any changes made on the frontend.

Making the change directly in the original file under vendor does however have an effect, so I'm sure that I'm editing the right file.

Someone that has an idea?

2 Answers 2


The file you try to copy is an XML file, but you set it as XHTML in the copied version.


that should be:


if you know the ui_component name like "customer_listing". You can update this ui_component's template inside your_module/view/adminhtml/ui_component/customer_listing.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="template" xsi:type="string">templates/my_template</item>

The 'my_template.xhtml' file will be located and copy the "default.xhtml" content into this file.


Your Answer

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

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