Form Bindings in Svelte
From the Svelte cheat sheet ยท Props & Bindings ยท verified Jul 2026
Form Bindings
Two-way data binding with form elements
javascript
<script>
let text = $state('');
let checked = $state(false);
let selected = $state('opt1');
let files = $state();
</script>
<input bind:value={text} />
<input type="checkbox" bind:checked />
<select bind:value={selected}>
<option value="opt1">Option 1</option>
<option value="opt2">Option 2</option>
</select>
<input type="file" bind:files />๐ bind:value for text and number inputs
โ๏ธ bind:checked for single checkboxes
๐ bind:group for radio and checkbox groups
๐ bind:files for file uploads with FileList