1. Static Component Guide
  2. Option select
  3. With option pre checked

Option select example

With option pre checked

How to call this example

<%= render "govuk_component/option_select" {
  key: "with_checked_value_set",
  title: "List of options",
  options_container_id: "list_of_vegetables",
  options: [
    {
      value: "potatoes",
      label: "Potatoes",
      name: "potatoes",
      checked: true
    },
    {
      value: "carrots",
      label: "Carrots",
      id: "carrots"
    },
    {
      value: "mash",
      label: "Mash",
      id: "mash"
    }
  ]
} %>

How it looks

List of options