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

More Svelte tasks

Back to the full Svelte cheat sheet