You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/Custom-input.md
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ If the default input types (FormInput, FormSelect ...) do not provide enough fun
6
6
7
7
The following code resembles a custom input component that shows an error when needed, paints gray background when modified, gets disabled when submitting and shows its defaultValue as a placeholder. You can tweak this custom input further by implementing transformations for different input types, allowing `HTMLInputAttributes` etc.
8
8
9
-
```jsx
9
+
```tsx
10
10
function CustomInput<T>(props: { form:FormState<T>; name:keyofT; children?:React.ReactNode }) {
@@ -62,7 +62,7 @@ Radio buttons must be given a value, and can be used for fields of different typ
62
62
63
63
Checkboxes behave like a boolean field by default, but when given a value, it behaves as a primitive array field (like a select with multiple = true). They can also set values on check/uncheck, this is useful for toggling fields.
0 commit comments