budibase/packages/standard-components/src/forms/OptionsField.svelte

36 lines
681 B
Svelte
Raw Normal View History

<script>
import { CoreSelect } from "@budibase/bbui"
import Field from "./Field.svelte"
export let field
export let label
export let placeholder
export let disabled = false
let fieldState
let fieldApi
let fieldSchema
</script>
<Field
{field}
{label}
{disabled}
type="options"
bind:fieldState
bind:fieldApi
bind:fieldSchema
>
{#if fieldState}
<CoreSelect
value={$fieldState.value}
id={$fieldState.fieldId}
disabled={$fieldState.disabled}
error={$fieldState.error}
options={fieldSchema?.constraints?.inclusion ?? []}
{placeholder}
2021-05-04 12:32:22 +02:00
on:change={e => fieldApi.setValue(e.detail)}
/>
{/if}
</Field>