lion-select
component is a wrapper around the native select
.
You cannot use interactive elements inside the options. Avoid very long names to facilitate the understandability and perceivability for screen reader users. Sets of options where each option name starts with the same word or phrase can also significantly degrade usability for keyboard and screen reader users.
- catches and forwards the select events
- can be set to required or disabled
npm i --save @lion/select
import '@lion/select/lion-select.js';
<lion-select
name="favoriteColor"
.errorValidators=${[['required']]}
>
<div slot="label">Favorite color</div>
<select slot="input">
<option selected hidden value>Please select</option>
<option value="red">Red</option>
<option value="hotpink">Hotpink</option>
<option value="teal">Teal</option>
</select>
</lion-select>
You can preselect an option by setting the property modelValue.
<lion-select
name="favoriteColor"
.modelValue="${'<value of option 2>'}"
>
...
</lion-select>