budibase/packages/standard-components/src/Select.svelte

24 lines
464 B
Svelte
Raw Normal View History

<script>
2020-02-03 10:50:30 +01:00
export let value = ""
export let className = ""
export let type = "text"
export let options = []
2020-02-03 10:50:30 +01:00
export let _bb
2020-02-03 10:50:30 +01:00
let actualValue = ""
2020-02-03 10:50:30 +01:00
const onchange = ev => {
if (_bb) {
_bb.setStateFromBinding(_bb.props.value, ev.target.value)
}
}
</script>
2020-02-03 10:50:30 +01:00
<select class={className} {value} on:change={onchange}>
<option />
{#each options as opt}
<option id={opt.id ? opt.id : opt.value}>{opt.value}</option>
{/each}
</select>