Component

Input length suggester

To suggest an input has a certain amount of characters

Search for usage of this component on GitHub.

How it looks (preview) (preview all)

 

How to call this component

<input id="an-input" class="govuk-input" placeholder="Type 10 characters to reveal">
<%= render "components/input_length_suggester", {
  for_id: "an-input",
  show_from: 10,
  message: "This field should be less than 15 characters. Current characters: {count}"
} %>

Accessibility acceptance criteria

The component must:

  • be hidden by default
  • be visible when a specified character number is reached
  • poll for changes to support screen readers