Select example

With error

If the user has to select an option, it is recommended that a radio button is used instead of a select, but this is not always possible. Note that error_id is optional, if it is not passed one will be generated automatically.

How it looks (preview)

Error: Please choose an option

How to call this example

<%= render "govuk_publishing_components/components/select", {
  id: "dropdown4-1",
  label: "How will you be travelling to the conference?",
  error_message: "Please choose an option",
  error_id: "error_id",
  options: [
    {
      text: "",
      value: ""
    },
    {
      text: "Public transport",
      value: "option1"
    },
    {
      text: "Will make own arrangements",
      value: "option2"
    }
  ]
} %>