Svelte · Junior · Question 32 of 76

How do you allow a parent to use bind:value on your component's prop?

<script>
  let { value = $bindable("") } = $props();
</script>

<input bind:value />

Explanation

Props flow down by default. $bindable explicitly allows two-way binding, which keeps data flow understandable.

Further reading

Problem with a question

Svelte · Junior · question 32

Test yourself

Take the Svelte · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz