v0.20.233 - 8.1 / 5.7

use:bind

Two-way binding between a form field and a signal. The value is read into the signal on input, and the element is updated when the signal changes. Accepts a single signal or a flat array of signals (all bound to the same element).

# Supported elements

  • <input type="checkbox"> — binds to checked
  • <input type="radio"> — binds checked to node.value === signal(); writing the radio's own value when selected
  • any other <input>, <textarea>, <select> — binds to value
  • contenteditable elements — binds to innerText, preserving the caret selection across updates

# Snippet