Select
The select and collection select components allow users to choose an option from a long list.
Before using a select component try asking users questions which will allow you to present them with fewer options.
Asking questions means you’re less likely to need to use the select component and can consider using a different solution, such as radios.
Select field with a label and hint
Taking greater control over the options
The #govuk_select
helper offers extra control over the
contents of a select
element. Like its Rails counterpart,
#select
the options can be set in a number of ways:
options_for_select
grouped_options_for_select
options_from_collection_for_select
option_groups_from_collection_for_select
- manually specifying the options using a block of HTML