Skip to content

Commit 106cdec

Browse files
committed
JSDoc for elements
1 parent ca85ad9 commit 106cdec

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

src/elements/FormError.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ export type FormErrorProps<T, Error, Key extends keyof T> = Omit<HTMLAttributes<
77
name: Key;
88
};
99

10+
/**
11+
* The builtin form error. You must always specify **form** and **name**.
12+
*
13+
* **FormInput**, **FormTextArea** and **FormSelect** are also available.
14+
*
15+
* When this error component is too basic for your needs, you can always [create your own](https://github.com/CodeStix/typed-react-form/wiki/FormError#custom-error-component).
16+
*/
1017
export function FormError<T, Error, Key extends keyof T>({ form, name, ...rest }: FormErrorProps<T, Error, Key>) {
1118
const { error } = useListener(form, name);
1219
if (!error || typeof error === "object") return null;

src/elements/FormInput.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export type FormInputProps<T, State, Error, Key extends keyof T, Value extends T
5151
/**
5252
* The builtin form input. You must always specify **form** and **name**. Use the **type** prop to specify what type of field it represents.
5353
*
54+
* **FormSelect**, **FormTextArea** and **FormError** are also available.
55+
*
5456
* When this component does not satisfy your needs, you can always [create your own](https://github.com/CodeStix/typed-react-form/wiki/Custom-inputs#example-custom-input).
5557
*/
5658
export function FormInput<T, State extends DefaultState, Error, Key extends keyof T, Value extends T[Key] | T[Key][keyof T[Key]]>({

src/elements/FormSelect.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ export type FormSelectProps<T, State, Error> = Omit<SelectHTMLAttributes<HTMLSel
1414
hideWhenNull?: boolean;
1515
};
1616

17+
/**
18+
* The builtin form select. You must always specify **form** and **name**. Use the normal `<option>` element to specify its possible values.
19+
*
20+
* **FormInput**, **FormTextArea** and **FormError** are also available.
21+
*
22+
* When this component does not satisfy your needs, you can always [create your own](https://github.com/CodeStix/typed-react-form/wiki/Custom-inputs#example-custom-input).
23+
*/
1724
export function FormSelect<T, State extends DefaultState, Error>({
1825
form,
1926
name,

src/elements/FormTextArea.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ export type FormTextAreaProps<T, State, Error> = Omit<TextareaHTMLAttributes<HTM
1414
hideWhenNull?: boolean;
1515
};
1616

17+
/**
18+
* The builtin form textarea. You must always specify **form** and **name**.
19+
*
20+
* **FormSelect**, **FormInput** and **FormError** are also available.
21+
*
22+
* When this component does not satisfy your needs, you can always [create your own](https://github.com/CodeStix/typed-react-form/wiki/Custom-inputs#example-custom-input).
23+
*/
1724
export function FormTextArea<T, State extends DefaultState, Error>({
1825
form,
1926
name,

0 commit comments

Comments
 (0)