frandevel
frandevel

Reputation: 747

vaadin-upload element: Change upload button's caption

Is there anyway to change the caption of the upload button from "UPLOAD FILES" to whatever is required?

Thanks a lot in advance

Upvotes: 0

Views: 493

Answers (1)

Morfic
Morfic

Reputation: 15518

Initial reply - for basic Vaadin

As per the docs you can use upload.setButtonCaption("My custom caption");. Am I missing something?

Custom upload button caption


Later update - for Vaadin elements

In this case you can use its i18n localization property. Unfortunately, for me the suggestion in the book to change a certain part with

document.querySelector('vaadin-upload#en').i18n.addFiles.many = 'Add Files;

did not work. However,

document.querySelector('vaadin-upload#en').set('i18n.addFiles.many', 'Add Files');

as seen in their github samples seems to work just fine. Below a sample and screenshot

<body>
    <vaadin-upload id="en"></vaadin-upload>
    <script>
        document.querySelector('vaadin-upload#en').set('i18n.addFiles.many', 'Add Files');
    </script>
</body>

Result:

Custom elements upload button caption

Upvotes: 1

Related Questions