Directory

← Back

File Download Wrapper

Helper add-on for making easy clickable file downloads.

Author

Rating

Popularity

4000+

This add-on is meant as a semi-replacement for the FileDownloader extension in earlier Vaadin versions. You can use it to create clickable download links or wrap components like buttons to achieve the same.

Note: intentionally doesn't support dynamic download behavior (like programmatically generating the file on click).

Sample code

    TextField textField = new TextField("Enter file contents");
    FileDownloadWrapper link = new FileDownloadWrapper("textfield.txt", () -> textField.getValue().getBytes());
    link.setText("Download textfield.txt that has contents of the TextField");
        Button button = new Button("Click to download");
        FileDownloadWrapper buttonWrapper = new FileDownloadWrapper(
            new StreamResource("foo.txt", () -> new ByteArrayInputStream("foo".getBytes())));
        buttonWrapper.wrapComponent(button);
        add(buttonWrapper);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Removed PolymerTemplate, use LitTemplate instead

Released
2023-02-16
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 23+
Vaadin 24+ in 7.0.0
Vaadin 14+ in 4.0.0
Vaadin 10+ in 1.1.0
Browser
Browser Independent

Vaadin Add-on Directory

Find open-source widgets, add-ons, themes, and integrations for your Vaadin application. Vaadin Add-on Directory
The channel for finding, promoting, and distributing Vaadin add-ons.
Online