rob-balfre / svelte-select

Svelte Select. A select component for Svelte
https://svelte-select-examples.vercel.app
Other
1.25k stars 175 forks source link

Is 'value' property in the bound object mandatory? #493

Closed PlkMarudny closed 1 year ago

PlkMarudny commented 1 year ago

Hi, not sure what is wrong with the following setup, but it does not seem to work, REPL here

<script>
    import Select from 'svelte-select@beta';

    let collection = [
        { display: 'One', id: 1 },
        { display: 'Two', id: 2 },
        { display: 'Three', id: 3 },
    ];

    let value;

    $: console.log(value);
</script>

<br />
<Select items={collection} id="id" label="display" bind:value/>
rob-balfre commented 1 year ago

@PlkMarudny you were just missing the itemId prop.

https://svelte.dev/repl/f1449e2a1e7b42058c1d6da5a521754c?version=3.52.0