Skip to content

experiment: add upload base styles and visual tests #9691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 30, 2025
Merged

Conversation

anezthes
Copy link
Contributor

@anezthes anezthes commented Jul 11, 2025

New Upload base style

Drag enabled (above), drag disabled (below).
localhost_8000_dev_upload html

"Dragover valid"
localhost_8000_dev_upload html (1)

Supported custom properties

Property Description
--vaadin-upload-background Background color of the upload container
--vaadin-upload-border Border of the upload container
--vaadin-upload-border-color Color of the upload container border
--vaadin-upload-border-radius Border radius of the upload container
--vaadin-upload-border-width Border width of the upload container
--vaadin-upload-gap Vertical spacing between upload elements
--vaadin-upload-padding Padding inside the upload container

Drop label

Property Description
--vaadin-upload-drop-label-color Text color of the drop label
--vaadin-upload-drop-label-font-size Font size of the drop label
--vaadin-upload-drop-label-font-weight Font weight of the drop label
--vaadin-upload-drop-label-gap Gap between the drop/upload icon and drop label
--vaadin-upload-drop-label-line-height Line height of the drop label

Drop/upload icon

Property Description
--vaadin-upload-icon-color Color of the upload icon

File

Property Description
--vaadin-upload-file-gap Spacing between the internal parts
--vaadin-upload-file-padding Padding of the container
File Icons
Property Description
--vaadin-upload-file-done-color Icon color for completed upload
--vaadin-upload-file-warning-color Icon color for warning status
File Name
Property Description
--vaadin-upload-file-name-color Text color of file name
--vaadin-upload-file-name-font-size Font size of file name
--vaadin-upload-file-name-font-weight Font weight of file name
--vaadin-upload-file-name-line-height Line height of file name
File Status
Property Description
--vaadin-upload-file-status-color Text color of upload status
--vaadin-upload-file-status-font-size Font size of upload status
--vaadin-upload-file-status-font-weight Font weight of upload status
--vaadin-upload-file-status-line-height Line height of upload status
File Error Message
Property Description
--vaadin-upload-file-error-color Text color for error messages
--vaadin-upload-file-error-font-size Font size of error messages
--vaadin-upload-file-error-font-weight Font weight of error messages
--vaadin-upload-file-error-line-height Line height of error messages
File Buttons
Property Description
--vaadin-upload-file-button-background Background color of file action buttons
--vaadin-upload-file-button-border Full border definition for file action buttons
--vaadin-upload-file-button-border-color Border color of file action buttons
--vaadin-upload-file-button-border-radius Border radius of file action buttons
--vaadin-upload-file-button-border-width Border width of file action buttons
--vaadin-upload-file-button-font-family Font family for file action buttons
--vaadin-upload-file-button-font-size Font size for file action buttons
--vaadin-upload-file-button-font-weight Font weight for file action buttons
--vaadin-upload-file-button-height Height of file action buttons
--vaadin-upload-file-button-line-height Line height for file action buttons
--vaadin-upload-file-button-padding Padding for file action buttons
--vaadin-upload-file-button-text-color Text color of file action buttons

File List

Property Description
--vaadin-upload-file-list-border Full border definition for list items
--vaadin-upload-file-list-border-color Border color of file list items
--vaadin-upload-file-list-border-width Border width of file list items

Concerns

  1. There are a few instances where I use gap: var(--vaadin-gap-container-inline); directly instead of defining a dedicated custom property — for example, in the primary-buttons and info parts.
  2. I haven’t added a gap property for the meta part, although I could see it being useful. It’s a bit tricky to determine what’s necessary versus what’s superfluous.
  3. I apply padding to the meta part using [part='done-icon'][hidden] + [part='warning-icon'][hidden] ~ [part='meta']. I’m not a fan of forcing visibility on one of the hidden icons (as is done in Lumo), but I’m also not entirely happy with the calc used here. Switching to grid might be a cleaner solution. Switched to grid.
  4. The gap on vaadin-upload creates some extra space at the bottom. The solution is to hide the list when it's empty, but as far as I know, there's no equivalent of vaadin-upload-file-list:not(:has(vaadin-upload-file)) that works in Shadow DOM. Moved gap to margin-top on the first file list item.

@jouni
Copy link
Member

jouni commented Jul 22, 2025

Agreed with @anezthes to refactor the vaadin-upload-file layout to use CSS grid instead of nested flex containers.

@anezthes
Copy link
Contributor Author

Agreed with @anezthes to refactor the vaadin-upload-file layout to use CSS grid instead of nested flex containers.

Done.

Copy link
Member

@jouni jouni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go. Needs visual tests.

@web-padawan web-padawan changed the title experiment: Upload base styles experiment: add upload base styles and visual tests Jul 30, 2025
Copy link

@web-padawan web-padawan merged commit 23e86bd into main Jul 30, 2025
10 checks passed
@web-padawan web-padawan deleted the base-upload branch July 30, 2025 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants