Skip to content

Commit a4bb6ac

Browse files
committed
Replace FormSelect occurences with Field
1 parent 53ab140 commit a4bb6ac

File tree

3 files changed

+31
-60
lines changed

3 files changed

+31
-60
lines changed

docs/reference/FormInput.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,35 @@ Checkboxes behave like a boolean field by default, but when given a value, it be
8686
}/>
8787
```
8888

89+
### Select
90+
91+
```tsx
92+
const form = useForm({
93+
language: "english",
94+
visitedCountries: ["sweden"]
95+
});
96+
97+
// Enum field
98+
<Field as="select" form={form} name="language">
99+
<option value="english">English</option>
100+
<option value="dutch">Dutch</option>
101+
<option value="french">French</option>
102+
</Field>
103+
104+
// Primitive array field (primitive meaning non-object)
105+
<Field as="select" form={form} name="visitedCountries" multiple>
106+
<option value="sweden">Sweden</option>
107+
<option value="russia">Russia</option>
108+
<option value="kroatia">Kroatia</option>
109+
</Field>
110+
```
111+
112+
### Textarea
113+
114+
### Styling/custom component
115+
116+
TODO
117+
89118
### Submit
90119

91120
You **cannot** use Field to create a submit button (type="submit"). Use one of the following alternatives:

docs/reference/FormSelect.md

Lines changed: 0 additions & 58 deletions
This file was deleted.

testing/src/ExampleForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ export function ExampleForm() {
100100
<option value="option3">Option 3</option>
101101
</Field>
102102
<pre>{`
103-
<FormSelect form={form} name="fieldName">
103+
<Field as="select" form={form} name="fieldName">
104104
<option value="option1">Option 1</option>
105105
<option value="option2">Option 2</option>
106106
<option value="option3">Option 3</option>
107-
</FormSelect>
107+
</Field>
108108
`}</pre>
109109

110110
{/* A checkbox input */}

0 commit comments

Comments
 (0)