Files
2026-07-25 20:36:53 -04:00

518 B

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.