Select with search (experimental) example
With grouped options
Options can be grouped
How it looks (preview)
How to call this example
<%= render "govuk_publishing_components/components/select_with_search", {
id: "dropdown-with-grouped-options",
label: "Select a city",
grouped_options: [
[
"England",
[
{
text: "Bath",
value: "bath"
},
{
text: "Bristol",
value: "bristol"
},
{
text: "London",
value: "london"
},
{
text: "Manchester",
value: "manchester"
}
]
],
[
"Northern Ireland",
[
{
text: "Bangor",
value: "bangor"
},
{
text: "Belfast",
value: "belfast"
}
]
],
[
"Scotland",
[
{
text: "Dundee",
value: "dundee"
},
{
text: "Edinburgh",
value: "edinburgh"
},
{
text: "Glasgow",
value: "glasgow"
}
]
],
[
"Wales",
[
{
text: "Cardiff",
value: "cardiff"
},
{
text: "Swansea",
value: "swansea"
}
]
]
]
} %>