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

23 lines
583 B
Svelte
Raw Normal View History

2021-03-31 11:59:07 +02:00
<script>
2021-04-16 12:05:53 +02:00
import Field from "./Field.svelte"
import Checkbox from "./Core/Checkbox.svelte"
2021-03-31 11:59:07 +02:00
import { createEventDispatcher } from "svelte"
2021-04-16 12:05:53 +02:00
export let value = null
export let label = null
export let labelPosition = "above"
export let text = null
export let disabled = false
export let error = null
2021-03-31 11:59:07 +02:00
2021-04-16 12:05:53 +02:00
const dispatch = createEventDispatcher()
const onChange = e => {
value = e.detail
dispatch("change", e.detail)
2021-03-31 11:59:07 +02:00
}
</script>
2021-04-16 12:05:53 +02:00
<Field {label} {labelPosition} {disabled} {error}>
<Checkbox {error} {disabled} {text} {value} on:change={onChange} />
</Field>