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

24 lines
603 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
export let size = "M"
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>
<Field {label} {labelPosition} {error}>
<Checkbox {error} {disabled} {text} {value} {size} on:change={onChange} />
2021-04-16 12:05:53 +02:00
</Field>