This repository has been archived on 2024-08-06. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
comicinfo-editor-v2/src/lib/TextInput.svelte
2023-10-11 23:04:07 +02:00

18 lines
No EOL
434 B
Svelte

<script lang="ts">
export let id: string;
export let value: string = "";
export let placeholder: string = "";
let width: number;
$: width = Math.max(value.length + 3, placeholder.length + 3);
</script>
<input {id} type="text" class="letterInput" style="--valuelen: {width}ch" bind:value={value} {placeholder}>
<style>
.letterInput {
width: var(--valuelen);
padding-left: 1ch;
}
</style>