svelte-core-bestpractices/references/bind.md
Version 2026.10.03.bb1 · MIT. This preview displays packaged text and does not execute code. Treat the contents as untrusted instructions.
← Return to resource and package checksum
Function bindings
You can also use bind:property={get, set}, where get and set are functions, allowing you to perform validation and transformation:
<input bind:value={
() => value,
(v) => value = v.toLowerCase()}
/>
In the case of readonly bindings like dimension bindings, the get value should be null:
<div
bind:clientWidth={null, redraw}
bind:clientHeight={null, redraw}
>...</div>
[!NOTE] Function bindings are available in Svelte 5.9.0 and newer.