ColorPicker
ColorPicker for Vaadin 23.3+
This is a simple ColorPicker for Vaadin 23.3+. The component has basic native color input part and additional field to input color value as text. It supports common CSS color definitions as input. You can also define a set of your own preset colors, which are populated in the dropdown.
Check also the GitHub repository for the code, it has complete set of unit and integration tests. This component serves as a demonstrator for a robust add-on component creation. You can read more about tips in my blog post.
https://vaadin.com/blog/custom-component-unit-and-integration-testing-tips
Sample code
ColorPicker colorPicker = new ColorPicker(); colorPicker.setLabel("Color"); colorPicker .setPresets(Arrays.asList(new ColorPreset("#00ff00", "Color 1"), new ColorPreset("#ff0000", "Color 2"))); colorPicker.addValueChangeListener(event -> { Notification.show(event.getValue()); });
Links
Compatibility
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 1.3.2
- Fix Vaadin 24 compatibility
- Remove feature flags from build
- Released
- 2023-03-11
- Maturity
- STABLE
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 23+
- Vaadin 24 in 1.4.1
- Vaadin 23 in 1.4.1
- Browser
- Firefox
- Opera
- Safari
- Google Chrome
- iOS Browser
- Android Browser
- Microsoft Edge
ColorPicker - Vaadin Add-on Directory
ColorPicker for Vaadin 23.3+View on GitHub
ColorPicker version 1.0.0
### Version 1.0.0
- The first version
ColorPicker version 1.1.0
### Version 1.1.0
- Fix issue with setting width
- Added ColorPicker#setInputMode(InputMode)
- Delegate focus to right element
- Fix focus ring style of the color picker element
- Fix compatibility with Vite builds
ColorPicker version 1.1.1
### Version 1.1.1
- Propagate theme attribute to relevant childs
ColorPicker version 1.1.2
### Version 1.1.2
- Fix ColorPreset to be serializable
ColorPicker version 1.1.3
### Version 1.1.3
- Fix colorPicker.setReadOnly(false) not working correctly
- Fix colorPicker.setValue(null) not working correctly
ColorPicker version 1.2.0
### Version 1.2.0
- Fix label style when disabled
- Added client side input validation
- Refactored ColorPickerVariant to follow Vaadin 23 convention
ColorPicker version 1.2.1
### Version 1.2.1
- Fix setReadOnly(false)
ColorPicker version 1.2.2
### Version 1.2.2
- Fix the missing required indicator
ColorPicker version 1.3.0
### Version 1.3.0
- Implemented HasTooltip, requires Vaadin 23.3.0
ColorPicker version 1.3.1
### Version 1.3.1
- Fixed focus / blur events not firing
ColorPicker version 1.3.2
### Version 1.3.2
- Fix Vaadin 24 compatibility
- Remove feature flags from build
ColorPicker version 1.3.3
### Version 1.3.3
- Fix bug that caused client side exception with Vaadin 24
ColorPicker version 1.3.5
### Version 1.3.5
- Programmatic setting of the value after invalid input should remove invalid state
- Re-release, 1.3.4 packaging was broken
ColorPicker version 1.3.6
### Version 1.3.6
- Remove feature flags from jar
ColorPicker version 1.4.0
### Version 1.4.0
- Support HTML captions for ColorPresets
- Added setNoClear
ColorPicker version 1.4.1
### Version 1.4.1
- Fix issue with ComboBox filtering