thisbeyond / solid-select

The Select component for Solid.
https://solid-select.com
MIT License
172 stars 18 forks source link

How to define predefined values ? #47

Closed gxanshu closed 2 months ago

gxanshu commented 1 year ago

is there any way to pre define the value in the Select box here is the thing that i want to do let suppose

const [value, setValue] = createSignal<string[]>(['apple', 'banana'])
const preValue = ['apple']

and then use that state in the select component

<Select
     multiple
     options={value()}
      value={preValue} // want to do something like that to already add apple and banana as selected
      onChange={setValue}
 />
martinpengellyphillips commented 2 months ago

Use initialValue instead of value and it should work. See kitchen sink example.