Custom Field Styling
Style Variants
The following variants are supported:
| Variant | Description | Supported by |
|---|---|---|
| Used to make label, helper, and error message smaller | Lumo |
| Used to position the helper above the field, and below the label | Aura, Lumo |
| Adds padding below the label for wrapping components without outer margin | Lumo |
Source code
MoneyField.java
CustomFieldSizeVariants.java
Money.java
custom-field-size-variants.tsx
custom-field-size-variants.ts
|
Note
| Custom Field doesn’t propagate its style variant to the individual field components it wraps. Each individual component’s style variant must be set individually. |
Style Properties
The following style properties can be used in CSS stylesheets to customize the appearance of this component.
To apply values to these properties globally in your application UI, place them in a CSS block using the html {…} selector.
See Component Style Properties for more information on style properties.
Label
| Property | Supported by |
|---|---|
| Lumo |
| Lumo |
| Aura, Lumo |
| Aura, Lumo |
| Aura, Lumo |
| Aura, Lumo |
| Aura, Lumo |
| Aura, Lumo |
CSS Selectors
The following CSS selectors can be used in stylesheets to target the various parts and states of the component. See the Styling documentation for more details on how to style components.
- Root element
-
vaadin-custom-field
States
- Required
-
vaadin-custom-field[required] - Focused
-
vaadin-custom-field[focused] - Keyboard focused
-
vaadin-custom-field[focus-ring] - Read-only
-
vaadin-custom-field[readonly] - Disabled
-
vaadin-custom-field[disabled] - Not empty
-
vaadin-custom-field[has-value] - Hovered
-
vaadin-custom-field:hover
Contents
- Field contents
-
vaadin-custom-field> your-element-here - Field elements wrapper
-
vaadin-custom-field::part(input-fields)
Label
- Field with label
-
vaadin-custom-field[has-label] - Label
-
vaadin-custom-field::part(label) - Label text
-
vaadin-custom-field> label - Required indicator
-
vaadin-custom-field::part(required-indicator)
Helper and Validation Error
- Field with helper
-
vaadin-custom-field[has-helper] - Helper
-
vaadin-custom-field::part(helper-text) - Helper text
-
vaadin-custom-field> [slot="helper"] - Invalid field
-
vaadin-custom-field[invalid] - Field with error message
-
vaadin-custom-field[has-error-message] - Error message
-
vaadin-custom-field::part(error-message) - Error message text
-
vaadin-custom-field> [slot="error-message"]