I would like to style Vaadin Upload component (vaadin-upload
) by changing appearance of the elements in file list, e.g. hide commands buttons (start, remove, retry). The file list contains vaadin-upload-file
elements.
For now I'm only able to customize vaadin-upload itself by adding custom theme to it and importing proper css - just like in this example: https://cookbook.vaadin.com/large-upload-area.
@CssImport(value = "./styles/custom-upload.css", themeFor = "vaadin-upload")
public class MainView extends VerticalLayout implements HasUrlParameter<String> {
public MainView() {
Upload upload = new Upload();
upload.getElement().getThemeList().add("custom-upload");
add(upload);
}
}
custom-upload.css:
:host([theme~="custom-upload"]) {
border: 0;
}
:host([theme~="custom-upload"]) [part="commands"] {
display: none;
}
Simplified DOM:
<vaadin-upload theme="custom-upload" target="VAADIN/dynamic/resource/1/70860bf9-21c4-474e-9418-fd5516c28736/upload">
#shadow-root
<div part="primary-buttons">...</div>
<slot name="file-list">
<div id="fileList" part="file-list">
<vaadin-upload-file>...</vaadin-upload-file>
</div>
</slot>
...
</vaadin-upload>
Documentation states that:
- vaadin-upload-file has customizable parts (e.g.
commands
) https://vaadin.com/components/vaadin-upload/html-api/elements/Vaadin.UploadFileElement. - moreover,
theme
value should be propagated to all sub-components according to https://vaadin.com/docs/v14/flow/styling/styling-components/#sub-components - which seems to be not the case.
Is there a way to attach custom theme
to vaadin-upload-file component?