Use the select component to let users select one option and no more from a long list of options.
Do not use the select component when there are better alternatives than using a select component.
Do not use the select component when you need to help users:
In these cases, use the checkboxes component (for a single option or a short list of options) or the checkboxes with filter component (for a long list of options) instead.
The select component is a form element that should always be used in a form. For a description of the usage, the behavior, the layout and validation of form elements, see the form component examples and documentation.
{% render '@form-item' with _context %}
<div class="form-item ">
<label for="select">select
<span class="label-optional">
Optional
</span>
</label>
<div class="field-message " id="select-description">
Optional field description.<br> --- <br> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium consectetur eveniet illo porro quis sint.
<div class="accolade "></div>
</div>
<div class="form-columns">
<div class="form-item-column">
<select name="select" id="select">
<option>Option 1</option>
<option>Option 2</option>
<optgroup label="Option group">
<option>Option 3</option>
<option>Option 4</option>
</optgroup>
</select>
</div>
<div class="form-item-column"></div>
</div>
</div>
{
"id": "select",
"label": "select",
"input_component": "input-select",
"options": [
{
"label": "Option 1"
},
{
"label": "Option 2"
},
{
"optgroup": true,
"label": "Option group",
"optgroupoptions": [
{
"label": "Option 3"
},
{
"label": "Option 4"
}
]
}
]
}