Component

URL preview

Generates URL from an input value and validates it with a server endpoint

This component uses an text input field to get the input value, sends the value to a server endpoint and returns the appropriate response

Search for usage of this component on GitHub.

How it looks (preview) (preview all)

Page address

You haven't entered a title yet

Unable to generate URL

http://www.gov.uk/news/

How to call this component

<%= render "components/url_preview", {
  title: "Page address",
  default_message: "You haven't entered a title yet",
  error_message: "Unable to generate URL",
  website_root: "http://www.gov.uk",
  base_path: "/news/"
} %>

Accessibility acceptance criteria

The component must:

  • update its content to reflect changes in the referenced input field