mirror of https://github.com/sveltejs/svelte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
447 B
19 lines
447 B
6 years ago
|
---
|
||
|
title: Select multiple
|
||
|
---
|
||
|
|
||
|
A select can have a `multiple` attribute, in which case it will populate an array rather than selecting a single value.
|
||
|
|
||
|
Returning to our [earlier ice cream example](tutorial/group-inputs), we can replace the checkboxes with a `<select multiple>`:
|
||
|
|
||
|
```html
|
||
|
<h2>Flavours</h2>
|
||
|
|
||
|
<select multiple bind:value={flavours}>
|
||
|
{#each menu as flavour}
|
||
|
<option value={flavour}>
|
||
|
{flavour}
|
||
|
</option>
|
||
|
{/each}
|
||
|
</select>
|
||
|
```
|