mirror of
https://github.com/LukeHagar/form.git
synced 2025-12-06 12:27:45 +00:00
docs: remove recently deleted props
This commit is contained in:
committed by
Corbin Crutchley
parent
7980336d03
commit
eea47f03dc
@@ -32,7 +32,12 @@ export default function App() {
|
|||||||
<form.Field
|
<form.Field
|
||||||
name="fullName"
|
name="fullName"
|
||||||
children={(field) => (
|
children={(field) => (
|
||||||
<input name={field.name} {...field.getInputProps()} />
|
<input
|
||||||
|
name={field.name}
|
||||||
|
value={field.state.value}
|
||||||
|
onBlur={field.handleBlur}
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -49,7 +49,11 @@ Example:
|
|||||||
name="firstName"
|
name="firstName"
|
||||||
children={(field) => (
|
children={(field) => (
|
||||||
<>
|
<>
|
||||||
<input {...field.getInputProps()} />
|
<input
|
||||||
|
value={field.state.value}
|
||||||
|
onBlur={field.handleBlur}
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
/>
|
||||||
<FieldInfo field={field} />
|
<FieldInfo field={field} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -68,12 +72,16 @@ const { value, error, touched, isValidating } = field.state
|
|||||||
|
|
||||||
## Field API
|
## Field API
|
||||||
|
|
||||||
The Field API is an object passed to the render prop function when creating a field. It provides methods for working with the field's state, such as getInputProps, which returns an object with props needed to bind the field to a form input element.
|
The Field API is an object passed to the render prop function when creating a field. It provides methods for working with the field's state.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
<input {...field.getInputProps()} />
|
<input
|
||||||
|
value={field.state.value}
|
||||||
|
onBlur={field.handleBlur}
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
/>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Validation
|
## Validation
|
||||||
@@ -92,7 +100,11 @@ Example:
|
|||||||
}}
|
}}
|
||||||
children={(field) => (
|
children={(field) => (
|
||||||
<>
|
<>
|
||||||
<input {...field.getInputProps()} />
|
<input
|
||||||
|
value={field.state.value}
|
||||||
|
onBlur={field.handleBlur}
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
/>
|
||||||
<FieldInfo field={field} />
|
<FieldInfo field={field} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -143,7 +155,12 @@ Example:
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor={field.name}>Name:</label>
|
<label htmlFor={field.name}>Name:</label>
|
||||||
<input name={field.name} {...field.getInputProps()} />
|
<input
|
||||||
|
name={field.name}
|
||||||
|
value={field.state.value}
|
||||||
|
onBlur={field.handleBlur}
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
/>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => hobbiesField.removeValue(i)}
|
onClick={() => hobbiesField.removeValue(i)}
|
||||||
@@ -162,7 +179,12 @@ Example:
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor={field.name}>Description:</label>
|
<label htmlFor={field.name}>Description:</label>
|
||||||
<input name={field.name} {...field.getInputProps()} />
|
<input
|
||||||
|
name={field.name}
|
||||||
|
value={field.state.value}
|
||||||
|
onBlur={field.handleBlur}
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
/>
|
||||||
<FieldInfo field={field} />
|
<FieldInfo field={field} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -202,7 +224,12 @@ Example:
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor={field.name}>Name:</label>
|
<label htmlFor={field.name}>Name:</label>
|
||||||
<input name={field.name} {...field.getInputProps()} />
|
<input
|
||||||
|
name={field.name}
|
||||||
|
value={field.state.value}
|
||||||
|
onBlur={field.handleBlur}
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
/>
|
||||||
<button type="button" onClick={() => hobbiesField.removeValue(i)}>
|
<button type="button" onClick={() => hobbiesField.removeValue(i)}>
|
||||||
X
|
X
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ function FieldInfo({ field }: { field: FieldApi<any, any> }) {
|
|||||||
<>
|
<>
|
||||||
{field.state.meta.touchedError ? (
|
{field.state.meta.touchedError ? (
|
||||||
<em>{field.state.meta.touchedError}</em>
|
<em>{field.state.meta.touchedError}</em>
|
||||||
) : null}{' '}
|
) : null}
|
||||||
{field.state.meta.isValidating ? 'Validating...' : null}
|
{field.state.meta.isValidating ? 'Validating...' : null}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
@@ -93,7 +93,12 @@ export default function App() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<label htmlFor={field.name}>First Name:</label>
|
<label htmlFor={field.name}>First Name:</label>
|
||||||
<input name={field.name} {...field.getInputProps()} />
|
<input
|
||||||
|
name={field.name}
|
||||||
|
value={field.state.value}
|
||||||
|
onBlur={field.handleBlur}
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
/>
|
||||||
<FieldInfo field={field} />
|
<FieldInfo field={field} />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
@@ -106,7 +111,12 @@ export default function App() {
|
|||||||
children={(field) => (
|
children={(field) => (
|
||||||
<>
|
<>
|
||||||
<label htmlFor={field.name}>Last Name:</label>
|
<label htmlFor={field.name}>Last Name:</label>
|
||||||
<input name={field.name} {...field.getInputProps()} />
|
<input
|
||||||
|
name={field.name}
|
||||||
|
value={field.state.value}
|
||||||
|
onBlur={field.handleBlur}
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
/>
|
||||||
<FieldInfo field={field} />
|
<FieldInfo field={field} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ function FieldInfo({ field }: { field: FieldApi<any, any> }) {
|
|||||||
<>
|
<>
|
||||||
{field.state.meta.touchedError ? (
|
{field.state.meta.touchedError ? (
|
||||||
<em>{field.state.meta.touchedError}</em>
|
<em>{field.state.meta.touchedError}</em>
|
||||||
) : null}{" "}
|
) : null}
|
||||||
{field.state.meta.isValidating ? "Validating..." : null}
|
{field.state.meta.isValidating ? "Validating..." : null}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -65,7 +65,12 @@ export default function App() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<label htmlFor={field.name}>First Name:</label>
|
<label htmlFor={field.name}>First Name:</label>
|
||||||
<input name={field.name} {...field.getInputProps()} />
|
<input
|
||||||
|
name={field.name}
|
||||||
|
value={field.state.value}
|
||||||
|
onBlur={field.handleBlur}
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
/>
|
||||||
<FieldInfo field={field} />
|
<FieldInfo field={field} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -78,7 +83,12 @@ export default function App() {
|
|||||||
children={(field) => (
|
children={(field) => (
|
||||||
<>
|
<>
|
||||||
<label htmlFor={field.name}>Last Name:</label>
|
<label htmlFor={field.name}>Last Name:</label>
|
||||||
<input name={field.name} {...field.getInputProps()} />
|
<input
|
||||||
|
name={field.name}
|
||||||
|
value={field.state.value}
|
||||||
|
onBlur={field.handleBlur}
|
||||||
|
onChange={(e) => field.handleChange(e.target.value)}
|
||||||
|
/>
|
||||||
<FieldInfo field={field} />
|
<FieldInfo field={field} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
"extends": "../../../tsconfig.json",
|
"extends": "../../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"noEmit": true
|
"noEmit": true,
|
||||||
|
"lib": ["DOM", "DOM.Iterable", "ES2020"]
|
||||||
},
|
},
|
||||||
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs", "rollup.config.js"]
|
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs", "rollup.config.js"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user