1. Collections Component Guide
  2. Form character count
  3. With error
Form character count example

With error

How it looks (preview)

Error: Detail must be 10 characters or less
You can enter up to 10 characters

How to call this example

<%= render "govuk_publishing_components/components/character_count", {
  textarea: {
    label: {
      text: "Can you provide more detail?"
    },
    name: "more-detail-error",
    error_message: "Detail must be 10 characters or less",
    value: "221B Baker Street
    London
    NW1 6XE
    "
  },
  maxlength: 10
} %>