Tags Input + Improved Date Input
This commit is contained in:
parent
85f86a36e8
commit
2b5a19fdd6
3 changed files with 79 additions and 10 deletions
src/lib/ListTextInput
26
src/lib/ListTextInput/ListTextInputElement.svelte
Normal file
26
src/lib/ListTextInput/ListTextInputElement.svelte
Normal file
|
@ -0,0 +1,26 @@
|
|||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
const dispatch = createEventDispatcher();
|
||||
export let id: number;
|
||||
export let value: string;
|
||||
|
||||
let width: number;
|
||||
|
||||
$: width = Math.max(value.length + 3, 6);
|
||||
|
||||
const handleClick = () => {
|
||||
dispatch('deleted', {
|
||||
tagId: id,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<input id="tag-{id}" type="text" class="letterInput" style="--valuelen: {width}ch" bind:value={value}>
|
||||
<button on:click={handleClick}>X</button>
|
||||
|
||||
<style>
|
||||
.letterInput {
|
||||
width: var(--valuelen);
|
||||
padding-left: 1ch;
|
||||
}
|
||||
</style>
|
Reference in a new issue