Datastar plugin

data-prop

Bind reactive signals to DOM element properties, one property or several at once, with any Datastar expression.

Test 1

Single property: input value

Uses data-prop:value to bind the value property.

Test 2

Single property: disabled state

Uses data-prop:disabled to control whether the input is disabled.

Test 3

Multiple properties

Uses data-prop without a key to set several properties at once.

Test 4

Different input types

Property binding on a checkbox and a range input.

Test 5

Select all checkboxes

An "all" checkbox toggles several checkboxes at once with the @setAll action. A single change handler on the parent handles every checkbox.

For this pattern, data-bind with data-effect is simpler than data-prop. The bulk update example in the Datastar docs shows a cleaner implementation.

Test 6

Complex properties

Sets a custom object property, customData, on an element. The element shows the property it received.