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

42 lines
853 B
Svelte
Raw Normal View History

2021-03-31 11:59:07 +02:00
<script>
import Field from "./Field.svelte"
import TextField from "./Core/TextField.svelte"
2021-03-31 11:59:07 +02:00
import { createEventDispatcher } from "svelte"
export let value = null
export let label = null
export let labelPosition = "above"
export let placeholder = null
export let type = "text"
2021-03-31 11:59:07 +02:00
export let disabled = false
export let readonly = false
export let error = null
export let updateOnChange = true
export let quiet = false
2021-03-31 11:59:07 +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}>
<TextField
{updateOnChange}
{error}
{disabled}
{readonly}
{value}
{placeholder}
2021-03-31 11:59:07 +02:00
{type}
{quiet}
on:change={onChange}
on:click
on:input
on:blur
on:focus
on:keyup
/>
</Field>