Skip to content

Commit 0ed3a35

Browse files
committed
FieldError documentation
1 parent da83663 commit 0ed3a35

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/Field.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export type FieldProps<T extends object, K extends keyof T, C> = {
1818
*/
1919
name: K;
2020
/**
21-
* The element to create, this can be a string specifying "input", "select", "textarea" or a custom component. Is "input" by default. The props of the passed component are available on this field.
21+
* The element to create, this can be a string specifying "input", "select", "textarea" or a custom component. Is "input" by default. The props of the passed custom component are available on this field.
2222
*
2323
* **Examples**
2424
*

src/FieldError.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,23 @@ export function FieldError<
1111
State = DefaultState
1212
>(
1313
props: {
14+
/**
15+
* The form to make a field for
16+
*/
1417
form: FormState<T, State, Error>;
18+
/**
19+
* The name of the field
20+
*/
1521
name: K;
22+
/**
23+
* The element to create, this can be a string specifying a tag "p", "span", "div" ... or a custom component. Is React.Fragment (`<></>`) by default. The props of the passed custom component are available on this field.
24+
*
25+
* **Examples**
26+
*
27+
* `<FieldError as="textarea" rows={10} />`
28+
*
29+
* `<FieldError as={CustomInput} {...} />`
30+
*/
1631
as?: C;
1732
transformer?: (error: Error) => React.ReactNode;
1833
} & Omit<ElementProps<C>, "transformer" | "as" | "name" | "form" | "children">

0 commit comments

Comments
 (0)