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, we can replace the checkboxes with a <select multiple>:


<select multiple bind:value={flavours}>
	{#each menu as flavour}
		<option value={flavour}>

Press and hold the control key (or the command key on MacOS) for selecting multiple options.

loading editor...


loading Svelte compiler...

loading editor...

Compiler options

result = svelte.compile(source, {

loading editor...