budibase/packages/bbui/src/Form/Multiselect.svelte

34 lines
800 B
Svelte
Raw Normal View History

2021-03-31 11:59:07 +02:00
<script>
import { createEventDispatcher } from "svelte"
import Multiselect from "./Core/Multiselect.svelte"
import Field from "./Field.svelte"
2021-03-31 11:59:07 +02:00
export let value = null
2021-04-15 13:14:51 +02:00
export let label = []
2021-03-31 11:59:07 +02:00
export let disabled = false
export let labelPosition = "above"
export let error = null
export let placeholder = null
export let options = []
export let getOptionLabel = option => option
export let getOptionValue = option => option
2021-03-31 11:59:07 +02:00
const dispatch = createEventDispatcher()
const onChange = e => {
dispatch("change", e.detail)
value = e.detail
2021-03-31 11:59:07 +02:00
}
</script>
<Field {label} {labelPosition} {disabled} {error}>
<Multiselect
{error}
{disabled}
{value}
{options}
{placeholder}
{getOptionLabel}
{getOptionValue}
on:change={onChange} />
</Field>