# lu-model `lu-model` is used to create a two-way data binding on form input elements. It automatically picks the right way to update the element based on the input type. ## Basic Usage: Text Inputs For ``, ` ``` ## Checkboxes ### Single Checkbox Binds to the `checked` property and uses a boolean value. ```html
``` ### Multiple Checkboxes Binds to the same array. Items are added/removed from the array based on the `value` attribute of the checkbox. ```html

Selected: {{ selectedItems }}

``` ## Radio Buttons Binds to the same property. The value will be set to the `value` attribute of the selected radio button. ```html

Picked: {{ picked }}

``` ## Select Menus ### Single Select Binds to the selected option's value. ```html

Selected: {{ selected }}

``` ### Multiple Select Binds to an array of selected option values. ```html

Selected: {{ selected }}

``` ## Modifiers ### `.lazy` By default, `lu-model` syncs the input on every `input` event. Use `.lazy` to sync after `change` events instead. ```html ``` ### `.number` Automatically cast the input value to a number. This is especially useful for `type="number"` or `type="range"`. ```html ``` ### `.trim` Automatically trim any whitespace from the beginning and end of the input value. ```html ``` ## Dynamic Binding and Custom Values You can bind the value of checkboxes or radio buttons to dynamic values using `lu-bind`. ```html
``` ### True/False Value for Checkboxes For checkboxes, you can customize the values used for checked and unchecked states using `:true-value` and `:false-value` bindings. ```html ``` > [!NOTE] > You must use the `:true-value` and `:false-value` binding syntax (with the `:` prefix), not plain HTML attributes.