Hi.
I am struggling to force my textfield in vaadin 14 to only be uppercase. In prev vaadin I added style to do this. But TextField now has no style method.
Hi.
I am struggling to force my textfield in vaadin 14 to only be uppercase. In prev vaadin I added style to do this. But TextField now has no style method.
You can do it with styles by using @CssImport
.
custom-textfield.css
, in <project-root>/frontend/styles/
:host(.uppercase) [part="value"]
{ // target the "value" part of elements that have the "uppercase" class name
text-transform: uppercase;
}
themeFor = "vaadin-text-field"
:@CssImport(value = "/styles/custom-textfield.css", themeFor = "vaadin-text-field")
public class MainView extends VerticalLayout {
//...
TextField textField = new TextField("Some label");
textField.setClassName("uppercase");