1. Collections Component Guide
  2. Select
  3. With different id and name
Select example

With different id and name

If no name is provided, name defaults to the (required) value of id.

How it looks (preview)

How to call this example

<%= render "govuk_publishing_components/components/select", {
  id: "dropdown1-1",
  label: "My Dropdown",
  name: "dropdown[1]",
  options: [
    {
      text: "Option one",
      value: "option1"
    },
    {
      text: "Option two",
      value: "option2"
    }
  ]
} %>