Hi Gunnar,
it’s not that different: you define the anchor with the new download handler stuff (which is BTW much easier than before) and then add a Button to the anchor. Hence the button becomes the visible face of the anchor like so:
Anchor anchor = new Anchor(
DownloadHandler.fromInputStream((event) -> {
try {
return new DownloadResponse(byte [] content, String filename, String mimeType, int length);
} catch (Exception e) {
return DownloadResponse.error(500);
}
}), "");
Button button = new Button("Export", VaadinIcon.FILE_TABLE.create());
anchor.addComponentAsFirst(exportButton);