--- url: /reference/items/DataModel.md --- # DataModel Use the `DataModel` component to create a two-way binding of a property of HTML form elements. This component should be used alongside the [`DataBind`](../DataBind/index.md), [`DataComputed`](../DataComputed/index.md) and [`DataEffect`](../DataEffect/index.md) components to update other elements accordingly. ## Usage Import the components in your main app and use the `DataModel` component on HTML form elements and the `DataBind` and `DataComputed` components on other elements that need to be updated accordingly. The `DataEffect` component can be used to execute side effects when the value changes. Inside a [`DataScope`](../DataScope/index.md), non-radio controls with the same key are mirrored models. In this example, both inputs use the native name `text`: editing either input updates the other one and every subscriber for that key. The first model uses `data-option-immediate` to hydrate the initial value. :::code-group ```js import { registerComponent } from '@studiometa/js-toolkit'; import { Action, DataBind, DataComputed, DataModel, DataScope } from '@studiometa/ui'; registerComponent(Action); registerComponent(DataScope); registerComponent(DataBind); registerComponent(DataComputed); registerComponent(DataModel); ``` :::