@@ -36,18 +36,18 @@ loginForm.email;
3636loginForm .password ;
3737```
3838
39- ### 3. Bind HTML inputs with ` [field ] ` directive
39+ ### 3. Bind HTML inputs with ` [formField ] ` directive
4040
41- Next, you bind your HTML inputs to the form using the ` [field ] ` directive, which creates two-way binding between them:
41+ Next, you bind your HTML inputs to the form using the ` [formField ] ` directive, which creates two-way binding between them:
4242
4343``` html
44- <input type =" email" [field ] =" loginForm.email" />
45- <input type =" password" [field ] =" loginForm.password" />
44+ <input type =" email" [formField ] =" loginForm.email" />
45+ <input type =" password" [formField ] =" loginForm.password" />
4646```
4747
4848As a result, user changes (such as typing in the field) automatically updates the form.
4949
50- NOTE: The ` [field ] ` directive also syncs field state for attributes like ` required ` , ` disabled ` , and ` readonly ` when appropriate.
50+ NOTE: The ` [formField ] ` directive also syncs field state for attributes like ` required ` , ` disabled ` , and ` readonly ` when appropriate.
5151
5252### 4. Read field values with ` value() `
5353
@@ -95,16 +95,16 @@ Here's a complete example:
9595
9696## Basic usage
9797
98- The ` [field ] ` directive works with all standard HTML input types. Here are the most common patterns:
98+ The ` [formField ] ` directive works with all standard HTML input types. Here are the most common patterns:
9999
100100### Text inputs
101101
102102Text inputs work with various ` type ` attributes and textareas:
103103
104104``` html
105105<!-- Text and email -->
106- <input type =" text" [field ] =" form.name" />
107- <input type =" email" [field ] =" form.email" />
106+ <input type =" text" [formField ] =" form.name" />
107+ <input type =" email" [formField ] =" form.email" />
108108```
109109
110110#### Numbers
@@ -113,7 +113,7 @@ Number inputs automatically convert between strings and numbers:
113113
114114``` html
115115<!-- Number - automatically converts to number type -->
116- <input type =" number" [field ] =" form.age" />
116+ <input type =" number" [formField ] =" form.age" />
117117```
118118
119119#### Date and time
@@ -122,8 +122,8 @@ Date inputs store values as `YYYY-MM-DD` strings, and time inputs use `HH:mm` fo
122122
123123``` html
124124<!-- Date and time - stores as ISO format strings -->
125- <input type =" date" [field ] =" form.eventDate" />
126- <input type =" time" [field ] =" form.eventTime" />
125+ <input type =" date" [formField ] =" form.eventDate" />
126+ <input type =" time" [formField ] =" form.eventTime" />
127127```
128128
129129If you need to convert date strings to Date objects, you can do so by passing the field value into ` Date() ` :
@@ -138,7 +138,7 @@ Textareas work the same way as text inputs:
138138
139139``` html
140140<!-- Textarea -->
141- <textarea [field ] =" form.message" rows =" 4" ></textarea >
141+ <textarea [formField ] =" form.message" rows =" 4" ></textarea >
142142```
143143
144144### Checkboxes
@@ -148,65 +148,65 @@ Checkboxes bind to boolean values:
148148``` html
149149<!-- Single checkbox -->
150150<label >
151- <input type =" checkbox" [field ] =" form.agreeToTerms" />
151+ <input type =" checkbox" [formField ] =" form.agreeToTerms" />
152152 I agree to the terms
153153</label >
154154```
155155
156156#### Multiple checkboxes
157157
158- For multiple options, create a separate boolean ` field ` for each:
158+ For multiple options, create a separate boolean ` formField ` for each:
159159
160160``` html
161161<label >
162- <input type =" checkbox" [field ] =" form.emailNotifications" />
162+ <input type =" checkbox" [formField ] =" form.emailNotifications" />
163163 Email notifications
164164</label >
165165<label >
166- <input type =" checkbox" [field ] =" form.smsNotifications" />
166+ <input type =" checkbox" [formField ] =" form.smsNotifications" />
167167 SMS notifications
168168</label >
169169```
170170
171171### Radio buttons
172172
173- Radio buttons work similarly to checkboxes. As long as the radio buttons use the same ` [field ] ` value, Signal Forms will automatically bind the same ` name ` attribute to all of them:
173+ Radio buttons work similarly to checkboxes. As long as the radio buttons use the same ` [formField ] ` value, Signal Forms will automatically bind the same ` name ` attribute to all of them:
174174
175175``` html
176176<label >
177- <input type =" radio" value =" free" [field ] =" form.plan" />
177+ <input type =" radio" value =" free" [formField ] =" form.plan" />
178178 Free
179179</label >
180180<label >
181- <input type =" radio" value =" premium" [field ] =" form.plan" />
181+ <input type =" radio" value =" premium" [formField ] =" form.plan" />
182182 Premium
183183</label >
184184```
185185
186- When a user selects a radio button, the form ` field ` stores the value from that radio button's ` value ` attribute. For example, selecting "Premium" sets ` form.plan().value() ` to ` "premium" ` .
186+ When a user selects a radio button, the form ` formField ` stores the value from that radio button's ` value ` attribute. For example, selecting "Premium" sets ` form.plan().value() ` to ` "premium" ` .
187187
188188### Select dropdowns
189189
190190Select elements work with both static and dynamic options:
191191
192192``` angular-html
193193<!-- Static options -->
194- <select [field ]="form.country">
194+ <select [formField ]="form.country">
195195 <option value="">Select a country</option>
196196 <option value="us">United States</option>
197197 <option value="ca">Canada</option>
198198</select>
199199
200200<!-- Dynamic options with @for -->
201- <select [field ]="form.productId">
201+ <select [formField ]="form.productId">
202202 <option value="">Select a product</option>
203203 @for (product of products; track product.id) {
204204 <option [value]="product.id">{{ product.name }}</option>
205205 }
206206</select>
207207```
208208
209- NOTE: Multiple select (` <select multiple> ` ) is not supported by the ` [field ] ` directive at this time.
209+ NOTE: Multiple select (` <select multiple> ` ) is not supported by the ` [formField ] ` directive at this time.
210210
211211## Validation and state
212212
0 commit comments