Directory

← Back

File Download Wrapper

Helper add-on for making easy clickable file downloads.

Author

Contributors

Rating

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.

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

Version for V24

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

Compatibility

Framework
Vaadin 24+
Vaadin 10+ in 1.0.0
Vaadin 14+ in 3.0.0
Vaadin 23+ in 5.0.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