Magento 2 Override Module-UI from Custom Theme

javascriptmagento2requirejstheme

Is there any option to override magento-ui vendor/magento/module-ui/view/base/web/templates templates from a theme?

Other module's templates overriding works fine:

var config = {
    map: {
        '*': {
            'Magento_Checkout/template/estimation.html': 'template/module-checkout/estimation.html',
            'Magento_Checkout/template/progress-bar.html': 'template/module-checkout/progress-bar.html'
        }
    }
};

But I see that module-ui templates' path is declared this way:

var config = {
    paths: {
        'ui/template': 'Magento_Ui/templates'
    }
}

And I can't override this file:

vendor/magento/module-ui/view/base/web/templates/form/element/textarea.html

Best Answer

Did you try to create in your theme a Magento_Ui/web/templates/form/element/textarea.html file ? This should override the base one , also don't forget to remove the theme files from pub/static/, this worked for me

Or in your custom module , create a [Namespace]/[Module]/view/frontend/requirejs-config.js file in your module with the following code

var config = {
    map: {
        '*': {
            'Magento_Checkout/template/estimation.html': '[Namespace]_[Module]/template/module-checkout/estimation.html',
            'Magento_Checkout/template/progress-bar.html': '[Namespace]_[Module]/template/module-checkout/progress-bar.html'
        }
    }
};