Skip to main content

Overview

HasHelperElement provides methods for interacting with helper text in Vaadin components. Helper text appears below form fields to provide additional guidance, explanations, or examples to users. It is persistent (unlike tooltips) and complements field labels. Interface Location: org.vaadin.addons.dramafinder.element.shared.HasHelperElement

Methods

getHelperLocator()

Returns a locator for the helper slot content element. The helper text is rendered in an element with slot="helper". Returns: Locator - Locator for the first element with slot="helper"

getHelperText()

Retrieves the text content of the helper slot. Returns: String - The helper text

assertHelperHasText()

Asserts that the helper text matches the expected value.
String
required
The expected helper text
Throws: AssertionError if the helper text does not match

Implementing Classes

The following element classes implement HasHelperElement:
  • All text input components (via HasInputFieldElement)
  • RadioButtonGroupElement
  • All components that support the helper slot

Usage Example

Implementation Details

Slot-Based Architecture

Vaadin components use slots for extensible content areas. Helper text is placed in the helper slot:
This selector finds the first element within the component that has slot="helper" attribute.

Helper Text Placement

Helper text typically appears:
  • Below the input field
  • Above any error messages
  • In a smaller, muted font
  • Persistently visible (not on hover/focus like tooltips)

Difference from Error Messages

Helper text is distinct from error messages:
  • Helper text: Proactive guidance (always visible when set)
  • Error messages: Reactive feedback (shown when invalid)
Both use slots but different ones (helper vs error-message).

Testing Patterns

Test Guidance Text

Test Format Examples

Test Character Count

Test Field Requirements

Test Dynamic Helper Changes

Best Practices

Use Helper Text for Additional Context

Helper text should provide useful information without repeating the label:

Keep Helper Text Concise

Helper text should be brief and scannable:

Use for Proactive Guidance

Helper text is for guidance before errors occur:

Test Helper Text Visibility

Verify helper text is visible when expected:

Common Use Cases

Password Requirements

Optional Field Indication

Format Instructions

Privacy Assurances

Character Limits

Dynamic Feedback

Accessibility Considerations

Helper Text and Screen Readers

Helper text should be associated with the field for screen readers. Vaadin handles this automatically through the helper slot mechanism.

Don’t Use for Critical Errors

Critical validation errors should use error messages, not helper text:

Supplement, Don’t Replace Labels

Helper text supplements labels but doesn’t replace them: