@iress-oss/ids-mcp-server 5.15.0 → 5.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/generated/docs/components_components-alert-docs.md +492 -0
  2. package/generated/docs/components_components-autocomplete-docs.md +3485 -0
  3. package/generated/docs/{components-autocomplete-recipes-docs.md → components_components-autocomplete-recipes-docs.md} +32 -14
  4. package/generated/docs/{components-badge-docs.md → components_components-badge-docs.md} +222 -30
  5. package/generated/docs/components_components-button-docs.md +2078 -0
  6. package/generated/docs/components_components-button-recipes-docs.md +37 -0
  7. package/generated/docs/components_components-buttongroup-docs.md +1045 -0
  8. package/generated/docs/components_components-card-docs.md +2276 -0
  9. package/generated/docs/{components-card-recipes-docs.md → components_components-card-recipes-docs.md} +131 -14
  10. package/generated/docs/components_components-checkbox-docs.md +1054 -0
  11. package/generated/docs/{components-checkboxgroup-docs.md → components_components-checkboxgroup-docs.md} +1000 -81
  12. package/generated/docs/{components-checkboxgroup-recipes-docs.md → components_components-checkboxgroup-recipes-docs.md} +101 -11
  13. package/generated/docs/{components-col-docs.md → components_components-col-docs.md} +331 -58
  14. package/generated/docs/components_components-combobox-docs.md +3767 -0
  15. package/generated/docs/{components-container-docs.md → components_components-container-docs.md} +61 -24
  16. package/generated/docs/{components-divider-docs.md → components_components-divider-docs.md} +83 -24
  17. package/generated/docs/{components-expander-docs.md → components_components-expander-docs.md} +264 -33
  18. package/generated/docs/{components-field-docs.md → components_components-field-docs.md} +814 -120
  19. package/generated/docs/components_components-filter-docs.md +4080 -0
  20. package/generated/docs/{components-form-docs.md → components_components-form-docs.md} +1515 -353
  21. package/generated/docs/{components-form-recipes-docs.md → components_components-form-recipes-docs.md} +170 -54
  22. package/generated/docs/components_components-hide-docs.md +293 -0
  23. package/generated/docs/components_components-icon-docs.md +1337 -0
  24. package/generated/docs/{components-inline-docs.md → components_components-inline-docs.md} +462 -42
  25. package/generated/docs/components_components-input-docs.md +1468 -0
  26. package/generated/docs/components_components-input-recipes-docs.md +367 -0
  27. package/generated/docs/components_components-inputcurrency-docs.md +432 -0
  28. package/generated/docs/{components-inputcurrency-recipes-docs.md → components_components-inputcurrency-recipes-docs.md} +110 -17
  29. package/generated/docs/components_components-label-docs.md +323 -0
  30. package/generated/docs/components_components-menu-docs.md +2345 -0
  31. package/generated/docs/components_components-menu-menuitem-docs.md +633 -0
  32. package/generated/docs/{components-modal-docs.md → components_components-modal-docs.md} +1625 -232
  33. package/generated/docs/components_components-navbar-docs.md +1847 -0
  34. package/generated/docs/{components-navbar-recipes-docs.md → components_components-navbar-recipes-docs.md} +697 -39
  35. package/generated/docs/{components-panel-docs.md → components_components-panel-docs.md} +754 -57
  36. package/generated/docs/components_components-placeholder-docs.md +92 -0
  37. package/generated/docs/components_components-popover-docs.md +1641 -0
  38. package/generated/docs/{components-popover-recipes-docs.md → components_components-popover-recipes-docs.md} +347 -17
  39. package/generated/docs/components_components-progress-docs.md +115 -0
  40. package/generated/docs/{components-provider-docs.md → components_components-provider-docs.md} +41 -32
  41. package/generated/docs/components_components-radio-docs.md +491 -0
  42. package/generated/docs/{components-radiogroup-docs.md → components_components-radiogroup-docs.md} +943 -75
  43. package/generated/docs/components_components-readonly-docs.md +263 -0
  44. package/generated/docs/components_components-richselect-docs.md +6497 -0
  45. package/generated/docs/{components-row-docs.md → components_components-row-docs.md} +353 -43
  46. package/generated/docs/{components-select-docs.md → components_components-select-docs.md} +719 -61
  47. package/generated/docs/components_components-skeleton-docs.md +480 -0
  48. package/generated/docs/{components-skeleton-recipes-docs.md → components_components-skeleton-recipes-docs.md} +50 -10
  49. package/generated/docs/{components-skiplink-docs.md → components_components-skiplink-docs.md} +53 -14
  50. package/generated/docs/components_components-slideout-docs.md +2262 -0
  51. package/generated/docs/components_components-slider-docs.md +1276 -0
  52. package/generated/docs/components_components-spinner-docs.md +82 -0
  53. package/generated/docs/{components-stack-docs.md → components_components-stack-docs.md} +223 -40
  54. package/generated/docs/components_components-table-docs.md +3651 -0
  55. package/generated/docs/components_components-tabset-docs.md +772 -0
  56. package/generated/docs/components_components-tabset-tab-docs.md +262 -0
  57. package/generated/docs/components_components-tag-docs.md +259 -0
  58. package/generated/docs/{components-text-docs.md → components_components-text-docs.md} +491 -51
  59. package/generated/docs/{components-toaster-docs.md → components_components-toaster-docs.md} +181 -79
  60. package/generated/docs/components_components-toaster-toast-docs.md +634 -0
  61. package/generated/docs/components_components-toggle-docs.md +461 -0
  62. package/generated/docs/{components-tooltip-docs.md → components_components-tooltip-docs.md} +286 -41
  63. package/generated/docs/{components-validationmessage-docs.md → components_components-validationmessage-docs.md} +230 -61
  64. package/generated/docs/components_contact-us-docs.md +12 -0
  65. package/generated/docs/{foundations-accessibility-docs.md → components_foundations-accessibility-docs.md} +11 -21
  66. package/generated/docs/{foundations-colours-docs.md → components_foundations-colour-030-colours.md} +8 -15
  67. package/generated/docs/{foundations-consistency-docs.md → components_foundations-consistency-docs.md} +12 -20
  68. package/generated/docs/{foundations-content-docs.md → components_foundations-content-docs.md} +6 -11
  69. package/generated/docs/components_foundations-introduction-docs.md +15 -0
  70. package/generated/docs/{foundations-principles-docs.md → components_foundations-principles-docs.md} +14 -24
  71. package/generated/docs/components_foundations-typography-docs.md +608 -0
  72. package/generated/docs/{foundations-user-experience-docs.md → components_foundations-user-experience-docs.md} +16 -26
  73. package/generated/docs/{foundations-visual-design-docs.md → components_foundations-visual-design-docs.md} +10 -17
  74. package/generated/docs/{frequently-asked-questions-docs.md → components_frequently-asked-questions-docs.md} +14 -23
  75. package/generated/docs/components_get-started-develop-docs.md +84 -0
  76. package/generated/docs/components_get-started-using-storybook-docs.md +55 -0
  77. package/generated/docs/components_introduction-docs.md +15 -0
  78. package/generated/docs/{patterns-loading-docs.md → components_patterns-loading-docs.md} +711 -143
  79. package/generated/docs/components_resources-changelog-docs.md +4 -0
  80. package/generated/docs/{resources-code-katas-docs.md → components_resources-code-katas-docs.md} +5 -9
  81. package/generated/docs/{resources-migration-guides-from-v4-to-v5-docs.md → components_resources-migration-guides-from-v4-to-v5-docs.md} +54 -239
  82. package/generated/docs/{versions-docs.md → components_versions-docs.md} +5 -8
  83. package/generated/docs/guidelines.md +484 -200
  84. package/generated/docs/introduction-docs.md +19 -30
  85. package/package.json +41 -45
  86. package/generated/docs/components-alert-docs.md +0 -130
  87. package/generated/docs/components-autocomplete-docs.md +0 -754
  88. package/generated/docs/components-button-docs.md +0 -362
  89. package/generated/docs/components-button-recipes-docs.md +0 -76
  90. package/generated/docs/components-buttongroup-docs.md +0 -310
  91. package/generated/docs/components-card-docs.md +0 -494
  92. package/generated/docs/components-checkbox-docs.md +0 -193
  93. package/generated/docs/components-combobox-docs.md +0 -1016
  94. package/generated/docs/components-filter-docs.md +0 -1109
  95. package/generated/docs/components-hide-docs.md +0 -265
  96. package/generated/docs/components-icon-docs.md +0 -553
  97. package/generated/docs/components-input-docs.md +0 -335
  98. package/generated/docs/components-input-recipes-docs.md +0 -140
  99. package/generated/docs/components-inputcurrency-docs.md +0 -157
  100. package/generated/docs/components-label-docs.md +0 -135
  101. package/generated/docs/components-menu-docs.md +0 -704
  102. package/generated/docs/components-menu-menuitem-docs.md +0 -193
  103. package/generated/docs/components-navbar-docs.md +0 -291
  104. package/generated/docs/components-placeholder-docs.md +0 -27
  105. package/generated/docs/components-popover-docs.md +0 -464
  106. package/generated/docs/components-progress-docs.md +0 -104
  107. package/generated/docs/components-radio-docs.md +0 -107
  108. package/generated/docs/components-readonly-docs.md +0 -89
  109. package/generated/docs/components-richselect-docs.md +0 -2433
  110. package/generated/docs/components-skeleton-docs.md +0 -214
  111. package/generated/docs/components-slideout-docs.md +0 -538
  112. package/generated/docs/components-slider-docs.md +0 -346
  113. package/generated/docs/components-spinner-docs.md +0 -59
  114. package/generated/docs/components-table-ag-grid-docs.md +0 -1074
  115. package/generated/docs/components-table-docs.md +0 -1305
  116. package/generated/docs/components-tabset-docs.md +0 -341
  117. package/generated/docs/components-tabset-tab-docs.md +0 -86
  118. package/generated/docs/components-tag-docs.md +0 -115
  119. package/generated/docs/components-toaster-toast-docs.md +0 -157
  120. package/generated/docs/components-toggle-docs.md +0 -158
  121. package/generated/docs/contact-us-docs.md +0 -27
  122. package/generated/docs/extensions-editor-docs.md +0 -288
  123. package/generated/docs/extensions-editor-recipes-docs.md +0 -39
  124. package/generated/docs/foundations-introduction-docs.md +0 -17
  125. package/generated/docs/foundations-typography-docs.md +0 -191
  126. package/generated/docs/get-started-develop-docs.md +0 -209
  127. package/generated/docs/get-started-using-storybook-docs.md +0 -68
  128. package/generated/docs/resources-changelog-docs.md +0 -6
  129. package/generated/docs/themes-available-themes-docs.md +0 -66
  130. package/generated/docs/themes-introduction-docs.md +0 -121
  131. package/generated/docs/themes-tokens-docs.md +0 -1200
  132. /package/{LICENSE.txt → LICENSE} +0 -0
@@ -1,22 +1,22 @@
1
- [](#form)Form
2
- =============
1
+ Form
2
+ ====
3
3
 
4
4
  Overview
5
5
  --------
6
6
 
7
7
  Use the `IressForm` component when you want to request, validate and process data from the user.
8
8
 
9
+ [](./iframe.html?id=components-form--simple)
10
+
9
11
  \*Required Name
10
12
 
11
13
  \*Required Email address
12
14
 
13
15
  Sign up
14
16
 
15
- Hide code
16
-
17
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
17
+ ```
18
18
 
19
- <IressForm\>
19
+ <ForwardedForm\>
20
20
  <IressStack gutter\="md"\>
21
21
  <IressFormField
22
22
  label\="Name"
@@ -44,16 +44,49 @@ Hide code
44
44
  \>
45
45
  Sign up </IressButton\>
46
46
  </IressStack\>
47
- </IressForm\>
47
+ </ForwardedForm\>
48
+
49
+ ```
50
+
51
+ Props
52
+ -----
53
+
54
+ Below are the custom props you can access when using `IressForm`, which includes the props for the [`useForm` hook from React Hook Forms](https://react-hook-form.com/docs/useform). In addition to these, you have access to the original props of the underlying [`form` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form).
55
+
56
+ | Name | Description | Default | Control |
57
+ | --- | --- | --- | --- |
58
+ | alert |
59
+ \-
60
+
61
+ | \- | Choose option...nonebasicAlert |
62
+ | children |
63
+
64
+ object
65
+
66
+
67
+
68
+ | \- | Choose option...nonesimplesupportedControlsreadOnly |
69
+ | form |
70
+
71
+ React hook form instance from `useForm`, use if you need more control over the internal state.
72
+
73
+ const form = useForm();
74
+ return <IressForm form={form} />;
75
+
76
+
77
+ UseFormReturn
48
78
 
49
- Copy
50
79
 
51
- [](#key-concepts)Key concepts
52
- -----------------------------
80
+
81
+ | \- | Set object |
82
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
83
+
84
+ Key concepts
85
+ ------------
53
86
 
54
87
  As of version 5, `IressForm` is built on top of [React Hook Forms](https://react-hook-form.com/). This provides you the power of React Hook Forms with the convenience of IDS form components. However, there are some key differences to be aware of as it may affect how you build your forms.
55
88
 
56
- ### [](#state-management)State management
89
+ ### State management
57
90
 
58
91
  `IressForm` manages the state of the form, including the form data and validation. This is done using the `useForm` hook from React Hook Forms. This hook provides a way to manage the form state, and provides methods to interact with the form. This was done to simplify the form components, make them more predictable (as the form becomes the single source of truth for all form related data) and improve performance by reducing re-renders (very important for large forms).
59
92
 
@@ -64,13 +97,15 @@ Due to this change, there are a few things you should consider during developmen
64
97
 
65
98
  See below an example comparing a version 4 and version 5 `IressForm` when managing form state.
66
99
 
67
- Mode
100
+ Diff
68
101
 
69
- DiffOldNew
102
+ Old
103
+
104
+ New
70
105
 
71
106
  <table class="css-1n5o7vh-diff-container"><tbody><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text">import { IressForm, IressField, IressInput, IressCheckboxGroup, IressCheckbox } from '@iress/components';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">import { IressForm, IressFormField, IressInput, IressCheckboxGroup, IressCheckbox } from '@iress-oss/ids-components';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-10regm7-empty-line"><pre></pre></td><td class="css-vl0irh-content css-10regm7-empty-line"><pre class="css-o1u8iu-content-text"></pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-10regm7-empty-line"><pre></pre></td><td class="css-vl0irh-content css-10regm7-empty-line"><pre class="css-o1u8iu-content-text"></pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text">export const App = () =&gt; {</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">const ConditionalFields = () =&gt; {</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> // We need to create our own state to manage the visibility of the fields, </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> // Instead of creating our own state, we can now use the form state via the useWatch hook, </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> // which means we have two sources of truth potentially making our code harder to maintain</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> // meaning we still have a single source of truth</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> const [show, setShow] = useState(['name']);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> const show = IressForm.useWatch({ name: 'show'});</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-10regm7-empty-line"><pre></pre></td><td class="css-vl0irh-content css-10regm7-empty-line"><pre class="css-o1u8iu-content-text"></pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> return (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressForm&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressField label="Show fields"&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressFormField </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressCheckboxGroup value={show} onChange={(newValues) =&gt; setShow(newValues)}&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> label="Show fields" </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> name="show"</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> render={(controlledProps) =&gt; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressCheckboxGroup {...controlledProps}&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> &lt;IressCheckbox value="name"&gt;Name&lt;/IressCheckbox&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> &lt;IressCheckbox value="email"&gt;Email&lt;/IressCheckbox&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> &lt;/IressCheckboxGroup&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;/IressField&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> {show.includes('name') &amp;&amp; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressField label="Name"&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> {show?.includes('name') &amp;&amp; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressInput name="name" /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressFormField </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;/IressField&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> label="Name" </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> name="name"</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> {show.includes('email') &amp;&amp; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> render={(controlledProps) =&gt; &lt;IressInput {...controlledProps} /&gt;}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressField label="Email"&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressInput name="email" type="email" /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;/IressField&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> {show?.includes('email') &amp;&amp; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressFormField </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;/IressForm&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> label="Email" </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> name="email"</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> render={(controlledProps) =&gt; &lt;IressInput {...controlledProps} type="email" /&gt;}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> )}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;/&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> );</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text">};</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-10regm7-empty-line css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-10regm7-empty-line css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"></pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">export const App = () =&gt; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressForm defaultValues={{ show: ['name'] }}&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;ConditionalFields /&gt; </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;/IressForm&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">);</pre></td></tr></tbody></table>
72
107
 
73
- ### [](#validation)Validation
108
+ ### Validation
74
109
 
75
110
  Validation is now done declaratively using the `rules` prop on the `IressFormField` component. This is based on the [rules available in React Hook Forms](https://www.react-hook-form.com/api/useform/register/#options). This change was made to allow for more complex validation rules to be implemented.
76
111
 
@@ -82,13 +117,15 @@ Due to this change, there are a few things you should consider during developmen
82
117
 
83
118
  See below an example comparing a version 4 and version 5 `IressForm` when adding validation rules.
84
119
 
85
- Mode
120
+ Diff
121
+
122
+ Old
86
123
 
87
- DiffOldNew
124
+ New
88
125
 
89
126
  <table class="css-1n5o7vh-diff-container"><tbody><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text">import { IressForm, IressField, IressInput, IressButton } from '@iress/components';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">import { IressForm, IressFormField, IressInput, IressButton } from '@iress-oss/ids-components';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-10regm7-empty-line"><pre></pre></td><td class="css-vl0irh-content css-10regm7-empty-line"><pre class="css-o1u8iu-content-text"></pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text">export const App = () =&gt; (</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressForm valueMissing="{{fieldName}} needs to be filled in!"&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressForm&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressField label="Name"&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressFormField </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressInput name="name" required /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> label="Name"</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;/IressField&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> name="name"</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressField label="Email"&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> render={(controlledProps) =&gt; &lt;IressInput {...controlledProps} /&gt;}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;IressInput name="email" maxLength={10} /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> rules={{ required: 'Name needs to be filled in!' }}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> &lt;/IressField&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> &lt;IressFormField </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> label="Email"</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> name="email"</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> render={(controlledProps) =&gt; &lt;IressInput {...controlledProps} type="email" maxLength={10} /&gt;}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> rules={{ maxLength: 10 }}</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> /&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> &lt;IressButton type="submit" mode="primary"&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> Sign up</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> &lt;/IressButton&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> &lt;/IressForm&gt;</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text">);</pre></td></tr></tbody></table>
90
127
 
91
- ### [](#syncing-state)Syncing state
128
+ ### Syncing state
92
129
 
93
130
  For most scenarios, you should use the `onSubmit` event to sync the form data with other state management systems (eg. server, browser storage or state management libraries such as Redux). This event is emitted when the form passes validation, and contains a map of the field names and the data entered by the user.
94
131
 
@@ -99,23 +136,6 @@ Consider the following for your development:
99
136
  * Only use other state management systems to fill out the form at the initial render using `defaultValues`. After that, use the `onSubmit` event to sync the form data with your state.
100
137
  * If you need to set form with data coming from an external system, use the `ref` of the form to `reset` the form values.
101
138
 
102
- \[data-radix-scroll-area-viewport\] {
103
- scrollbar-width: none;
104
- -ms-overflow-style: none;
105
- -webkit-overflow-scrolling: touch;
106
- }
107
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
108
- display: none;
109
- }
110
- :where(\[data-radix-scroll-area-viewport\]) {
111
- display: flex;
112
- flex-direction: column;
113
- align-items: stretch;
114
- }
115
- :where(\[data-radix-scroll-area-content\]) {
116
- flex-grow: 1;
117
- }
118
-
119
139
  const ref \= useRef<FormRef | null\>(null);
120
140
  const api \= useApi();
121
141
  const handleSubmit \= async (data) \=> {
@@ -129,12 +149,12 @@ return (
129
149
  ... </IressForm\>
130
150
  );
131
151
 
132
- Copy
152
+ ```
133
153
 
134
- [](#usage)Usage
135
- ---------------
154
+ Usage
155
+ -----
136
156
 
137
- ### [](#fields)Fields
157
+ ### Fields
138
158
 
139
159
  Use the `IressFormField` component to create form fields. This component is a layout component that wraps around form controls such as `IressInput`. It provides a consistent layout for form fields, and hooks into the `IressForm` component to provide validation and error handling.
140
160
 
@@ -144,35 +164,20 @@ It has three required props:
144
164
  * `label`: The label for the field.
145
165
  * `render`: A render prop that renders the form control. It is passed an object containing the props to be spread onto the form control to allow it to be controlled by the form.
146
166
 
147
- \[data-radix-scroll-area-viewport\] {
148
- scrollbar-width: none;
149
- -ms-overflow-style: none;
150
- -webkit-overflow-scrolling: touch;
151
- }
152
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
153
- display: none;
154
- }
155
- :where(\[data-radix-scroll-area-viewport\]) {
156
- display: flex;
157
- flex-direction: column;
158
- align-items: stretch;
159
- }
160
- :where(\[data-radix-scroll-area-content\]) {
161
- flex-grow: 1;
162
- }
163
-
164
167
  <IressFormField
165
168
  name\="email"
166
169
  label\="Email"
167
170
  render\={(controlledProps) \=> <IressInput {...controlledProps} type\="email" />}
168
171
  />
169
172
 
170
- Copy
173
+ ```
171
174
 
172
- #### [](#supported-form-controls)Supported form controls
175
+ #### Supported form controls
173
176
 
174
177
  Here are some examples of how to use `IressFormField` with different form controls. If you are using a form control that has multiple inputs inside (for example, `IressCheckboxGroup`), you can use `IressFormFieldset`, which changes the HTML structure to use a `fieldset` and `legend` element to group the inputs.
175
178
 
179
+ [](./iframe.html?id=components-form--fields)
180
+
176
181
  \*Required Name
177
182
 
178
183
  \*Required Date
@@ -205,6 +210,8 @@ Salad
205
210
 
206
211
  Type to copy an existing character's name
207
212
 
213
+ Type at least 1 character to search
214
+
208
215
  \*Required Your star wars sidekick
209
216
 
210
217
  None selected
@@ -221,11 +228,9 @@ None selected
221
228
 
222
229
  Sign up
223
230
 
224
- Hide code
231
+ ```
225
232
 
226
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
227
-
228
- <IressForm\>
233
+ <ForwardedForm\>
229
234
  <IressStack gutter\="md"\>
230
235
  <IressFormField
231
236
  label\="Name"
@@ -393,29 +398,146 @@ Hide code
393
398
  \>
394
399
  Sign up </IressButton\>
395
400
  </IressStack\>
396
- </IressForm\>
401
+ </ForwardedForm\>
402
+
403
+ ```
404
+
405
+ #### Props
406
+
407
+ | Name | Description | Default | Control |
408
+ | --- | --- | --- | --- |
409
+ | alert |
410
+ \-
411
+
412
+ | \- | Choose option...nonebasicAlert |
413
+ | children |
414
+
415
+ object
416
+
417
+
418
+
419
+ | \- | Choose option...nonesimplesupportedControlsreadOnly |
420
+ | form |
421
+
422
+ React hook form instance from `useForm`, use if you need more control over the internal state.
423
+
424
+ const form = useForm();
425
+ return <IressForm form={form} />;
426
+
427
+
428
+ UseFormReturn
429
+
430
+
431
+
432
+ | \- | Set object |
433
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
434
+
435
+ #### IressFormField props
436
+
437
+ | Name | Description | Default |
438
+ | --- | --- | --- |
439
+ | label |
440
+ string
441
+
442
+
443
+
444
+ | \- |
445
+ | name\* |
446
+
447
+ Name of the field. It is used to identify the field in the form. It must be unique within the form.
448
+
449
+ FieldPath
450
+
397
451
 
398
- Copy
399
452
 
400
- ### [](#rules)Rules
453
+ | \- |
454
+ | readOnly |
455
+
456
+ Text to be displayed instead of input field.
457
+
458
+ boolean
459
+
460
+
461
+
462
+ | \- |
463
+ | render\* |
464
+
465
+ Render function to provide the control for the field. To ensure the field is correctly registered with the form, the control must be passed as props to the rendered component. (eg. `render={field => <IressInput {...field} />}`)
466
+
467
+ (field: FormFieldRenderProps<T>) => ReactNode
468
+
469
+ | \- |
470
+ | rules |
471
+
472
+ Validation rules, including: required, min, max, minLength, maxLength, pattern, validate
473
+
474
+ [Learn more](https://react-hook-form.com/api/useform/register)
475
+
476
+ intersection
477
+
478
+
479
+
480
+ | \- |
481
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
482
+ | Show Field props itemsField props | Show Field props items |
483
+
484
+ ### Rules
401
485
 
402
486
  Use the `rules` prop on the `IressFormField` component to add validation rules. These are based on the [rules available in React Hook Forms](https://www.react-hook-form.com/api/useform/register/#options). The following rules are supported.
403
487
 
404
488
  **Note:** In version 5, you can no longer override default error messages for the whole form. To override the default messages, you must specify them in the `rules` prop per `IressFormField`.
405
489
 
406
- #### [](#required)`required`
490
+ #### `required`
407
491
 
408
492
  A boolean which, if `true`, indicates that the input must have a value before the form can be submitted. You can assign a string to return a custom error message.
409
493
 
494
+ [](./iframe.html?id=components-form-rules--required)
495
+
410
496
  \*Required Default message
411
497
 
412
498
  \*Required Custom message
413
499
 
414
500
  Validate
415
501
 
416
- Show code
502
+ ```
503
+
504
+ <ForwardedForm\>
505
+ <IressStack gutter\="lg"\>
506
+ <IressFormField
507
+ hint\=""
508
+ label\="Default message"
509
+ name\="IressInput-default"
510
+ render\={(controlledProps) \=> <IressInput {...controlledProps} />}
511
+ rules\={{
512
+ required: true
513
+ }}
514
+ />
515
+ <IressFormField
516
+ hint\=""
517
+ label\="Custom message"
518
+ name\="IressInput-custom"
519
+ render\={(controlledProps) \=> <IressInput {...controlledProps} />}
520
+ rules\={{
521
+ required: 'Please check this field'
522
+ }}
523
+ />
524
+ <IressButton
525
+ mode\="primary"
526
+ type\="submit"
527
+ \>
528
+ Validate </IressButton\>
529
+ </IressStack\>
530
+ </ForwardedForm\>
531
+
532
+ ```
533
+
534
+ #### Adjust
417
535
 
418
- #### [](#maxlength)`maxLength`
536
+ | Name | Description | Default | Control |
537
+ | --- | --- | --- | --- |
538
+ | Show Storybook only itemsStorybook only | Show Storybook only items |
539
+
540
+ #### `maxLength`
419
541
 
420
542
  The maximum character length of the value to accept for this input.
421
543
 
@@ -424,6 +546,8 @@ The maximum character length of the value to accept for this input.
424
546
  * For `IressInput`, you should also set the `maxLength` to stop the user from entering more characters than allowed.
425
547
  * Only applies to: `IressAutocomplete`, `IressInput`, `IressRadioGroup` and `IressSelect`.
426
548
 
549
+ [](./iframe.html?id=components-form-rules--max-length)
550
+
427
551
  Default message
428
552
 
429
553
  Enter a maximum length of 5 characters
@@ -434,11 +558,9 @@ Enter a maximum length of 5 characters
434
558
 
435
559
  Validate
436
560
 
437
- Hide code
561
+ ```
438
562
 
439
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
440
-
441
- <IressForm\>
563
+ <ForwardedForm\>
442
564
  <IressStack gutter\="lg"\>
443
565
  <IressFormField
444
566
  hint\="Enter a maximum length of 5 characters"
@@ -467,11 +589,17 @@ Hide code
467
589
  \>
468
590
  Validate </IressButton\>
469
591
  </IressStack\>
470
- </IressForm\>
592
+ </ForwardedForm\>
593
+
594
+ ```
471
595
 
472
- Copy
596
+ #### Adjust
473
597
 
474
- #### [](#minlength)`minLength`
598
+ | Name | Description | Default | Control |
599
+ | --- | --- | --- | --- |
600
+ | Show Storybook only itemsStorybook only | Show Storybook only items |
601
+
602
+ #### `minLength`
475
603
 
476
604
  The minimum character length of the value to accept for this input.
477
605
 
@@ -480,6 +608,8 @@ The minimum character length of the value to accept for this input.
480
608
  * For `IressInput`, you should also set the `minLength` to stop the user from entering more characters than allowed.
481
609
  * Only applies to: `IressAutocomplete`, `IressInput`, `IressRadioGroup` and `IressSelect`.
482
610
 
611
+ [](./iframe.html?id=components-form-rules--min-length)
612
+
483
613
  Default message
484
614
 
485
615
  Enter a minimum length of 7 characters
@@ -490,11 +620,9 @@ Enter a minimum length of 7 characters
490
620
 
491
621
  Validate
492
622
 
493
- Hide code
494
-
495
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
623
+ ```
496
624
 
497
- <IressForm\>
625
+ <ForwardedForm\>
498
626
  <IressStack gutter\="lg"\>
499
627
  <IressFormField
500
628
  hint\="Enter a minimum length of 7 characters"
@@ -523,11 +651,17 @@ Hide code
523
651
  \>
524
652
  Validate </IressButton\>
525
653
  </IressStack\>
526
- </IressForm\>
654
+ </ForwardedForm\>
527
655
 
528
- Copy
656
+ ```
529
657
 
530
- #### [](#max)`max`
658
+ #### Adjust
659
+
660
+ | Name | Description | Default | Control |
661
+ | --- | --- | --- | --- |
662
+ | Show Storybook only itemsStorybook only | Show Storybook only items |
663
+
664
+ #### `max`
531
665
 
532
666
  The maximum number to accept for this input.
533
667
 
@@ -535,6 +669,8 @@ The maximum number to accept for this input.
535
669
 
536
670
  * Only applies to: `IressAutocomplete`, `IressInput`, `IressRadioGroup` and `IressSelect`.
537
671
 
672
+ [](./iframe.html?id=components-form-rules--max)
673
+
538
674
  Default message
539
675
 
540
676
  Select a maximum of 2
@@ -545,11 +681,9 @@ Select a maximum of 2
545
681
 
546
682
  Validate
547
683
 
548
- Hide code
684
+ ```
549
685
 
550
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
551
-
552
- <IressForm\>
686
+ <ForwardedForm\>
553
687
  <IressStack gutter\="lg"\>
554
688
  <IressFormField
555
689
  hint\="Select a maximum of 2"
@@ -578,11 +712,17 @@ Hide code
578
712
  \>
579
713
  Validate </IressButton\>
580
714
  </IressStack\>
581
- </IressForm\>
715
+ </ForwardedForm\>
716
+
717
+ ```
718
+
719
+ #### Adjust
582
720
 
583
- Copy
721
+ | Name | Description | Default | Control |
722
+ | --- | --- | --- | --- |
723
+ | Show Storybook only itemsStorybook only | Show Storybook only items |
584
724
 
585
- #### [](#min)`min`
725
+ #### `min`
586
726
 
587
727
  The minimum number to accept for this input.
588
728
 
@@ -590,6 +730,8 @@ The minimum number to accept for this input.
590
730
 
591
731
  * Only applies to: `IressAutocomplete`, `IressInput`, `IressRadioGroup` and `IressSelect`.
592
732
 
733
+ [](./iframe.html?id=components-form-rules--min)
734
+
593
735
  Default message
594
736
 
595
737
  Select a minimum of 20
@@ -600,11 +742,9 @@ Select a minimum of 20
600
742
 
601
743
  Validate
602
744
 
603
- Hide code
604
-
605
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
745
+ ```
606
746
 
607
- <IressForm\>
747
+ <ForwardedForm\>
608
748
  <IressStack gutter\="lg"\>
609
749
  <IressFormField
610
750
  hint\="Select a minimum of 20"
@@ -633,11 +773,17 @@ Hide code
633
773
  \>
634
774
  Validate </IressButton\>
635
775
  </IressStack\>
636
- </IressForm\>
776
+ </ForwardedForm\>
777
+
778
+ ```
779
+
780
+ #### Adjust
637
781
 
638
- Copy
782
+ | Name | Description | Default | Control |
783
+ | --- | --- | --- | --- |
784
+ | Show Storybook only itemsStorybook only | Show Storybook only items |
639
785
 
640
- #### [](#pattern)`pattern`
786
+ #### `pattern`
641
787
 
642
788
  The accepted regex pattern for the input.
643
789
 
@@ -645,6 +791,8 @@ The accepted regex pattern for the input.
645
791
 
646
792
  * Only applies to: `IressAutocomplete`, `IressInput`, `IressRadioGroup` and `IressSelect`.
647
793
 
794
+ [](./iframe.html?id=components-form-rules--pattern)
795
+
648
796
  Default message
649
797
 
650
798
  Enter a valid email address
@@ -655,11 +803,9 @@ Enter a valid email address
655
803
 
656
804
  Validate
657
805
 
658
- Hide code
659
-
660
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
806
+ ```
661
807
 
662
- <IressForm\>
808
+ <ForwardedForm\>
663
809
  <IressStack gutter\="lg"\>
664
810
  <IressFormField
665
811
  hint\="Enter a valid email address"
@@ -683,16 +829,24 @@ Hide code
683
829
  \>
684
830
  Validate </IressButton\>
685
831
  </IressStack\>
686
- </IressForm\>
832
+ </ForwardedForm\>
833
+
834
+ ```
687
835
 
688
- Copy
836
+ #### Adjust
689
837
 
690
- #### [](#mindate)`minDate`
838
+ | Name | Description | Default | Control |
839
+ | --- | --- | --- | --- |
840
+ | Show Storybook only itemsStorybook only | Show Storybook only items |
841
+
842
+ #### `minDate`
691
843
 
692
844
  The minimum date to accept for this input.
693
845
 
694
846
  **Note:** This is a custom rule created for `IressForm` and its sub-components. It will translate the rule into a `validate` rule for react-hook-forms. It will not work with a `validate` function, only if you set the `validate` prop to an `object` of functions.
695
847
 
848
+ [](./iframe.html?id=components-form-rules--min-date)
849
+
696
850
  Default message
697
851
 
698
852
  Enter a date after today
@@ -703,11 +857,9 @@ Enter a date after today
703
857
 
704
858
  Validate
705
859
 
706
- Hide code
860
+ ```
707
861
 
708
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
709
-
710
- <IressForm\>
862
+ <ForwardedForm\>
711
863
  <IressStack gutter\="lg"\>
712
864
  <IressFormField
713
865
  hint\="Enter a date after today"
@@ -715,7 +867,7 @@ Hide code
715
867
  name\="IressInputDate-default"
716
868
  render\={(controlledProps) \=> <IressInput {...controlledProps} />}
717
869
  rules\={{
718
- minDate: new Date('2025-06-27T03:58:57.380Z')
870
+ minDate: new Date('2025-12-04T07:07:37.519Z')
719
871
  }}
720
872
  />
721
873
  <IressFormField
@@ -726,7 +878,7 @@ Hide code
726
878
  rules\={{
727
879
  minDate: {
728
880
  message: 'Please enter a date after today!',
729
- value: new Date('2025-06-27T03:58:57.380Z')
881
+ value: new Date('2025-12-04T07:07:37.519Z')
730
882
  }
731
883
  }}
732
884
  />
@@ -736,16 +888,169 @@ Hide code
736
888
  \>
737
889
  Validate </IressButton\>
738
890
  </IressStack\>
739
- </IressForm\>
891
+ </ForwardedForm\>
892
+
893
+ ```
894
+
895
+ #### Props
896
+
897
+ | Name | Description | Default | Control |
898
+ | --- | --- | --- | --- |
899
+ | children |
900
+ \-
901
+
902
+ | \- | \- |
903
+ | context |
904
+
905
+ This context object is mutable and will be injected into the `resolver`'s second argument (eg. [Yup](https://github.com/jquense/yup) validation's context object).
906
+
907
+ [Learn more](https://react-hook-form.com/docs/useform#context)
908
+
909
+ UseFormProps\['context'\]
910
+
911
+ | \- | Set object |
912
+ | criteriaMode |
913
+
914
+ Display all validation errors or one at a time.
915
+
916
+ [Learn more](https://react-hook-form.com/docs/useform#criteriaMode)
917
+
918
+ UseFormProps\['criteriaMode'\]
919
+
920
+ | \- | Set object |
921
+ | defaultValues |
922
+
923
+ Default values to be passed through when an input is unset.
924
+
925
+ [Learn more](https://react-hook-form.com/docs/useform#defaultValues)
926
+
927
+ DefaultValues
928
+
929
+
930
+
931
+ | \- | Set object |
932
+ | delayError |
933
+
934
+ Delay error from appearing instantly.
935
+
936
+ [Learn more](https://react-hook-form.com/docs/useform#delayError)
937
+
938
+ UseFormProps\['delayError'\]
939
+
940
+ | \- | Set object |
941
+ | form |
942
+
943
+ React hook form instance from `useForm`, use if you need more control over the internal state.
944
+
945
+ const form = useForm();
946
+ return <IressForm form={form} />;
947
+
948
+
949
+ UseFormReturn
950
+
951
+
952
+
953
+ | \- | Set object |
954
+ | mode |
955
+
956
+ Configure the validation strategy **before** a user submits the form.
957
+
958
+ [Learn more](https://react-hook-form.com/docs/useform#mode)
959
+
960
+ UseFormProps\['mode'\]
961
+
962
+ |
963
+
964
+ 'onSubmit'
965
+
966
+ | Set object |
967
+ | progressive |
968
+
969
+ Progressive Enhancement only applicable for SSR framework. [Learn more](https://react-hook-form.com/docs/useform)
970
+
971
+ UseFormProps\['progressive'\]
972
+
973
+ | \- | Set object |
974
+ | resetOptions |
975
+
976
+ This property is related to value update behaviors.
977
+
978
+ [Learn more](https://react-hook-form.com/docs/useform#resetOptions)
979
+
980
+ UseFormProps\['resetOptions'\]
981
+
982
+ | \- | Set object |
983
+ | resolver |
984
+
985
+ This function allows you to use any external validation library such as Yup, Zod, Joi, Vest, Ajv and many others.
986
+
987
+ [Learn more](https://react-hook-form.com/docs/useform#resolver)
988
+
989
+ UseFormProps\['resolver'\]
740
990
 
741
- Copy
991
+ | \- | Set object |
992
+ | reValidateMode |
742
993
 
743
- #### [](#maxdate)`maxDate`
994
+ Configure validation strategy when inputs with errors get re-validated **after** a user submits the form.
995
+
996
+ [Learn more](https://react-hook-form.com/docs/useform#reValidateMode)
997
+
998
+ UseFormProps\['reValidateMode'\]
999
+
1000
+ |
1001
+
1002
+ 'onChange'
1003
+
1004
+ | Set object |
1005
+ | shouldFocusError |
1006
+
1007
+ When set to true, and the user submits a form that fails validation, focus is set on the first field with an error. By default, it is set based on the `hiddenErrorSummary` prop.
1008
+
1009
+ * If hiddenErrorSummary is true, it will focus on the first field with an error.
1010
+ * If hiddenErrorSummary is false, it will focus on the error summary.
1011
+
1012
+ [Learn more](https://react-hook-form.com/docs/useform#shouldFocusError)
1013
+
1014
+ UseFormProps\['shouldFocusError'\]
1015
+
1016
+ | \- | Set object |
1017
+ | shouldUnregister |
1018
+
1019
+ By default, an input value will be retained when input is removed. However, you can set `shouldUnregister` to `true` to `unregister` input during unmount.
1020
+
1021
+ [Learn more](https://react-hook-form.com/docs/useform#shouldUnregister)
1022
+
1023
+ UseFormProps\['shouldUnregister'\]
1024
+
1025
+ | \- | Set object |
1026
+ | shouldUseNativeValidation |
1027
+
1028
+ This config will enable browser native validation. It will also enable CSS selectors :valid and:invalid making styling inputs easier.
1029
+
1030
+ [Learn more](https://react-hook-form.com/docs/useform#shouldUseNativeValidation)
1031
+
1032
+ UseFormProps\['shouldUseNativeValidation'\]
1033
+
1034
+ | \- | Set object |
1035
+ | values |
1036
+
1037
+ The values prop will react to changes and update the form values, which is useful when your form needs to be updated by external state or server data.
1038
+
1039
+ [Learn more](https://react-hook-form.com/docs/useform#values)
1040
+
1041
+ UseFormProps\['values'\]
1042
+
1043
+ | \- | Set object |
1044
+ | Show Storybook only itemsStorybook only | Show Storybook only items |
1045
+
1046
+ #### `maxDate`
744
1047
 
745
1048
  The maximum date to accept for this input.
746
1049
 
747
1050
  **Note:** This is a custom rule created for `IressForm` and its sub-components. It will translate the rule into a `validate` rule for react-hook-forms. It will not work with a `validate` function, only if you set the `validate` prop to an `object` of functions.
748
1051
 
1052
+ [](./iframe.html?id=components-form-rules--max-date)
1053
+
749
1054
  Default message
750
1055
 
751
1056
  Enter a date before today
@@ -756,11 +1061,9 @@ Enter a date before today
756
1061
 
757
1062
  Validate
758
1063
 
759
- Hide code
1064
+ ```
760
1065
 
761
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
762
-
763
- <IressForm\>
1066
+ <ForwardedForm\>
764
1067
  <IressStack gutter\="lg"\>
765
1068
  <IressFormField
766
1069
  hint\="Enter a date before today"
@@ -768,7 +1071,7 @@ Hide code
768
1071
  name\="IressInputDate-default"
769
1072
  render\={(controlledProps) \=> <IressInput {...controlledProps} />}
770
1073
  rules\={{
771
- maxDate: new Date('2025-06-27T03:58:57.380Z')
1074
+ maxDate: new Date('2025-12-04T07:07:37.519Z')
772
1075
  }}
773
1076
  />
774
1077
  <IressFormField
@@ -779,7 +1082,7 @@ Hide code
779
1082
  rules\={{
780
1083
  maxDate: {
781
1084
  message: 'Please enter a date before today!',
782
- value: new Date('2025-06-27T03:58:57.380Z')
1085
+ value: new Date('2025-12-04T07:07:37.519Z')
783
1086
  }
784
1087
  }}
785
1088
  />
@@ -789,16 +1092,169 @@ Hide code
789
1092
  \>
790
1093
  Validate </IressButton\>
791
1094
  </IressStack\>
792
- </IressForm\>
1095
+ </ForwardedForm\>
1096
+
1097
+ ```
1098
+
1099
+ #### Props
1100
+
1101
+ | Name | Description | Default | Control |
1102
+ | --- | --- | --- | --- |
1103
+ | children |
1104
+ \-
1105
+
1106
+ | \- | \- |
1107
+ | context |
1108
+
1109
+ This context object is mutable and will be injected into the `resolver`'s second argument (eg. [Yup](https://github.com/jquense/yup) validation's context object).
1110
+
1111
+ [Learn more](https://react-hook-form.com/docs/useform#context)
1112
+
1113
+ UseFormProps\['context'\]
1114
+
1115
+ | \- | Set object |
1116
+ | criteriaMode |
1117
+
1118
+ Display all validation errors or one at a time.
1119
+
1120
+ [Learn more](https://react-hook-form.com/docs/useform#criteriaMode)
1121
+
1122
+ UseFormProps\['criteriaMode'\]
1123
+
1124
+ | \- | Set object |
1125
+ | defaultValues |
1126
+
1127
+ Default values to be passed through when an input is unset.
1128
+
1129
+ [Learn more](https://react-hook-form.com/docs/useform#defaultValues)
1130
+
1131
+ DefaultValues
1132
+
1133
+
1134
+
1135
+ | \- | Set object |
1136
+ | delayError |
1137
+
1138
+ Delay error from appearing instantly.
1139
+
1140
+ [Learn more](https://react-hook-form.com/docs/useform#delayError)
1141
+
1142
+ UseFormProps\['delayError'\]
1143
+
1144
+ | \- | Set object |
1145
+ | form |
1146
+
1147
+ React hook form instance from `useForm`, use if you need more control over the internal state.
1148
+
1149
+ const form = useForm();
1150
+ return <IressForm form={form} />;
1151
+
1152
+
1153
+ UseFormReturn
1154
+
1155
+
1156
+
1157
+ | \- | Set object |
1158
+ | mode |
1159
+
1160
+ Configure the validation strategy **before** a user submits the form.
793
1161
 
794
- Copy
1162
+ [Learn more](https://react-hook-form.com/docs/useform#mode)
795
1163
 
796
- #### [](#email)`email`
1164
+ UseFormProps\['mode'\]
1165
+
1166
+ |
1167
+
1168
+ 'onSubmit'
1169
+
1170
+ | Set object |
1171
+ | progressive |
1172
+
1173
+ Progressive Enhancement only applicable for SSR framework. [Learn more](https://react-hook-form.com/docs/useform)
1174
+
1175
+ UseFormProps\['progressive'\]
1176
+
1177
+ | \- | Set object |
1178
+ | resetOptions |
1179
+
1180
+ This property is related to value update behaviors.
1181
+
1182
+ [Learn more](https://react-hook-form.com/docs/useform#resetOptions)
1183
+
1184
+ UseFormProps\['resetOptions'\]
1185
+
1186
+ | \- | Set object |
1187
+ | resolver |
1188
+
1189
+ This function allows you to use any external validation library such as Yup, Zod, Joi, Vest, Ajv and many others.
1190
+
1191
+ [Learn more](https://react-hook-form.com/docs/useform#resolver)
1192
+
1193
+ UseFormProps\['resolver'\]
1194
+
1195
+ | \- | Set object |
1196
+ | reValidateMode |
1197
+
1198
+ Configure validation strategy when inputs with errors get re-validated **after** a user submits the form.
1199
+
1200
+ [Learn more](https://react-hook-form.com/docs/useform#reValidateMode)
1201
+
1202
+ UseFormProps\['reValidateMode'\]
1203
+
1204
+ |
1205
+
1206
+ 'onChange'
1207
+
1208
+ | Set object |
1209
+ | shouldFocusError |
1210
+
1211
+ When set to true, and the user submits a form that fails validation, focus is set on the first field with an error. By default, it is set based on the `hiddenErrorSummary` prop.
1212
+
1213
+ * If hiddenErrorSummary is true, it will focus on the first field with an error.
1214
+ * If hiddenErrorSummary is false, it will focus on the error summary.
1215
+
1216
+ [Learn more](https://react-hook-form.com/docs/useform#shouldFocusError)
1217
+
1218
+ UseFormProps\['shouldFocusError'\]
1219
+
1220
+ | \- | Set object |
1221
+ | shouldUnregister |
1222
+
1223
+ By default, an input value will be retained when input is removed. However, you can set `shouldUnregister` to `true` to `unregister` input during unmount.
1224
+
1225
+ [Learn more](https://react-hook-form.com/docs/useform#shouldUnregister)
1226
+
1227
+ UseFormProps\['shouldUnregister'\]
1228
+
1229
+ | \- | Set object |
1230
+ | shouldUseNativeValidation |
1231
+
1232
+ This config will enable browser native validation. It will also enable CSS selectors :valid and:invalid making styling inputs easier.
1233
+
1234
+ [Learn more](https://react-hook-form.com/docs/useform#shouldUseNativeValidation)
1235
+
1236
+ UseFormProps\['shouldUseNativeValidation'\]
1237
+
1238
+ | \- | Set object |
1239
+ | values |
1240
+
1241
+ The values prop will react to changes and update the form values, which is useful when your form needs to be updated by external state or server data.
1242
+
1243
+ [Learn more](https://react-hook-form.com/docs/useform#values)
1244
+
1245
+ UseFormProps\['values'\]
1246
+
1247
+ | \- | Set object |
1248
+ | Show Storybook only itemsStorybook only | Show Storybook only items |
1249
+
1250
+ #### `email`
797
1251
 
798
1252
  Ensures the input is a valid email address.
799
1253
 
800
1254
  **Note:** This is a custom rule created for `IressForm` and its sub-components. It will translate the rule into a `validate` rule for react-hook-forms. It will not work with a `validate` function, only if you set the `validate` prop to an `object` of functions.
801
1255
 
1256
+ [](./iframe.html?id=components-form-rules--email)
1257
+
802
1258
  Default message
803
1259
 
804
1260
  Enter an email address
@@ -809,11 +1265,9 @@ Enter an email address
809
1265
 
810
1266
  Validate
811
1267
 
812
- Hide code
813
-
814
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
1268
+ ```
815
1269
 
816
- <IressForm\>
1270
+ <ForwardedForm\>
817
1271
  <IressStack gutter\="lg"\>
818
1272
  <IressFormField
819
1273
  hint\="Enter an email address"
@@ -839,11 +1293,162 @@ Hide code
839
1293
  \>
840
1294
  Validate </IressButton\>
841
1295
  </IressStack\>
842
- </IressForm\>
1296
+ </ForwardedForm\>
1297
+
1298
+ ```
1299
+
1300
+ #### Props
1301
+
1302
+ | Name | Description | Default | Control |
1303
+ | --- | --- | --- | --- |
1304
+ | children |
1305
+ \-
1306
+
1307
+ | \- | \- |
1308
+ | context |
1309
+
1310
+ This context object is mutable and will be injected into the `resolver`'s second argument (eg. [Yup](https://github.com/jquense/yup) validation's context object).
1311
+
1312
+ [Learn more](https://react-hook-form.com/docs/useform#context)
1313
+
1314
+ UseFormProps\['context'\]
1315
+
1316
+ | \- | Set object |
1317
+ | criteriaMode |
1318
+
1319
+ Display all validation errors or one at a time.
1320
+
1321
+ [Learn more](https://react-hook-form.com/docs/useform#criteriaMode)
1322
+
1323
+ UseFormProps\['criteriaMode'\]
1324
+
1325
+ | \- | Set object |
1326
+ | defaultValues |
1327
+
1328
+ Default values to be passed through when an input is unset.
1329
+
1330
+ [Learn more](https://react-hook-form.com/docs/useform#defaultValues)
843
1331
 
844
- Copy
1332
+ DefaultValues
845
1333
 
846
- #### [](#validate)`validate`
1334
+
1335
+
1336
+ | \- | Set object |
1337
+ | delayError |
1338
+
1339
+ Delay error from appearing instantly.
1340
+
1341
+ [Learn more](https://react-hook-form.com/docs/useform#delayError)
1342
+
1343
+ UseFormProps\['delayError'\]
1344
+
1345
+ | \- | Set object |
1346
+ | form |
1347
+
1348
+ React hook form instance from `useForm`, use if you need more control over the internal state.
1349
+
1350
+ const form = useForm();
1351
+ return <IressForm form={form} />;
1352
+
1353
+
1354
+ UseFormReturn
1355
+
1356
+
1357
+
1358
+ | \- | Set object |
1359
+ | mode |
1360
+
1361
+ Configure the validation strategy **before** a user submits the form.
1362
+
1363
+ [Learn more](https://react-hook-form.com/docs/useform#mode)
1364
+
1365
+ UseFormProps\['mode'\]
1366
+
1367
+ |
1368
+
1369
+ 'onSubmit'
1370
+
1371
+ | Set object |
1372
+ | progressive |
1373
+
1374
+ Progressive Enhancement only applicable for SSR framework. [Learn more](https://react-hook-form.com/docs/useform)
1375
+
1376
+ UseFormProps\['progressive'\]
1377
+
1378
+ | \- | Set object |
1379
+ | resetOptions |
1380
+
1381
+ This property is related to value update behaviors.
1382
+
1383
+ [Learn more](https://react-hook-form.com/docs/useform#resetOptions)
1384
+
1385
+ UseFormProps\['resetOptions'\]
1386
+
1387
+ | \- | Set object |
1388
+ | resolver |
1389
+
1390
+ This function allows you to use any external validation library such as Yup, Zod, Joi, Vest, Ajv and many others.
1391
+
1392
+ [Learn more](https://react-hook-form.com/docs/useform#resolver)
1393
+
1394
+ UseFormProps\['resolver'\]
1395
+
1396
+ | \- | Set object |
1397
+ | reValidateMode |
1398
+
1399
+ Configure validation strategy when inputs with errors get re-validated **after** a user submits the form.
1400
+
1401
+ [Learn more](https://react-hook-form.com/docs/useform#reValidateMode)
1402
+
1403
+ UseFormProps\['reValidateMode'\]
1404
+
1405
+ |
1406
+
1407
+ 'onChange'
1408
+
1409
+ | Set object |
1410
+ | shouldFocusError |
1411
+
1412
+ When set to true, and the user submits a form that fails validation, focus is set on the first field with an error. By default, it is set based on the `hiddenErrorSummary` prop.
1413
+
1414
+ * If hiddenErrorSummary is true, it will focus on the first field with an error.
1415
+ * If hiddenErrorSummary is false, it will focus on the error summary.
1416
+
1417
+ [Learn more](https://react-hook-form.com/docs/useform#shouldFocusError)
1418
+
1419
+ UseFormProps\['shouldFocusError'\]
1420
+
1421
+ | \- | Set object |
1422
+ | shouldUnregister |
1423
+
1424
+ By default, an input value will be retained when input is removed. However, you can set `shouldUnregister` to `true` to `unregister` input during unmount.
1425
+
1426
+ [Learn more](https://react-hook-form.com/docs/useform#shouldUnregister)
1427
+
1428
+ UseFormProps\['shouldUnregister'\]
1429
+
1430
+ | \- | Set object |
1431
+ | shouldUseNativeValidation |
1432
+
1433
+ This config will enable browser native validation. It will also enable CSS selectors :valid and:invalid making styling inputs easier.
1434
+
1435
+ [Learn more](https://react-hook-form.com/docs/useform#shouldUseNativeValidation)
1436
+
1437
+ UseFormProps\['shouldUseNativeValidation'\]
1438
+
1439
+ | \- | Set object |
1440
+ | values |
1441
+
1442
+ The values prop will react to changes and update the form values, which is useful when your form needs to be updated by external state or server data.
1443
+
1444
+ [Learn more](https://react-hook-form.com/docs/useform#values)
1445
+
1446
+ UseFormProps\['values'\]
1447
+
1448
+ | \- | Set object |
1449
+ | Show Storybook only itemsStorybook only | Show Storybook only items |
1450
+
1451
+ #### `validate`
847
1452
 
848
1453
  You can pass a callback function as the argument to validate, or you can pass an object of callback functions to validate against all of them. This function will be executed on its own without depending on other validation rules included.
849
1454
 
@@ -851,6 +1456,8 @@ You can pass a callback function as the argument to validate, or you can pass an
851
1456
 
852
1457
  * for `object` or `array` input data, it's recommended to use the validate function for validation as the other rules mostly apply to `string`, `string[]`, `number` and `boolean` data types.
853
1458
 
1459
+ [](./iframe.html?id=components-form-rules--validate)
1460
+
854
1461
  Default message
855
1462
 
856
1463
  If checkbox, click two items to pass. Anything else, make sure it is Google.
@@ -869,11 +1476,9 @@ Writing
869
1476
 
870
1477
  Validate
871
1478
 
872
- Hide code
1479
+ ```
873
1480
 
874
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
875
-
876
- <IressForm\>
1481
+ <ForwardedForm\>
877
1482
  <IressStack gutter\="lg"\>
878
1483
  <IressFormFieldset
879
1484
  hint\="If checkbox, click two items to pass. Anything else, make sure it is Google."
@@ -915,27 +1520,178 @@ Hide code
915
1520
  \>
916
1521
  Validate </IressButton\>
917
1522
  </IressStack\>
918
- </IressForm\>
1523
+ </ForwardedForm\>
1524
+
1525
+ ```
1526
+
1527
+ #### Props
1528
+
1529
+ | Name | Description | Default | Control |
1530
+ | --- | --- | --- | --- |
1531
+ | children |
1532
+ \-
1533
+
1534
+ | \- | \- |
1535
+ | context |
1536
+
1537
+ This context object is mutable and will be injected into the `resolver`'s second argument (eg. [Yup](https://github.com/jquense/yup) validation's context object).
1538
+
1539
+ [Learn more](https://react-hook-form.com/docs/useform#context)
1540
+
1541
+ UseFormProps\['context'\]
1542
+
1543
+ | \- | Set object |
1544
+ | criteriaMode |
1545
+
1546
+ Display all validation errors or one at a time.
1547
+
1548
+ [Learn more](https://react-hook-form.com/docs/useform#criteriaMode)
1549
+
1550
+ UseFormProps\['criteriaMode'\]
1551
+
1552
+ | \- | Set object |
1553
+ | defaultValues |
1554
+
1555
+ Default values to be passed through when an input is unset.
1556
+
1557
+ [Learn more](https://react-hook-form.com/docs/useform#defaultValues)
1558
+
1559
+ DefaultValues
1560
+
1561
+
1562
+
1563
+ | \- | Set object |
1564
+ | delayError |
1565
+
1566
+ Delay error from appearing instantly.
1567
+
1568
+ [Learn more](https://react-hook-form.com/docs/useform#delayError)
1569
+
1570
+ UseFormProps\['delayError'\]
1571
+
1572
+ | \- | Set object |
1573
+ | form |
1574
+
1575
+ React hook form instance from `useForm`, use if you need more control over the internal state.
1576
+
1577
+ const form = useForm();
1578
+ return <IressForm form={form} />;
1579
+
1580
+
1581
+ UseFormReturn
1582
+
1583
+
1584
+
1585
+ | \- | Set object |
1586
+ | mode |
1587
+
1588
+ Configure the validation strategy **before** a user submits the form.
1589
+
1590
+ [Learn more](https://react-hook-form.com/docs/useform#mode)
1591
+
1592
+ UseFormProps\['mode'\]
1593
+
1594
+ |
1595
+
1596
+ 'onSubmit'
1597
+
1598
+ | Set object |
1599
+ | progressive |
1600
+
1601
+ Progressive Enhancement only applicable for SSR framework. [Learn more](https://react-hook-form.com/docs/useform)
1602
+
1603
+ UseFormProps\['progressive'\]
1604
+
1605
+ | \- | Set object |
1606
+ | resetOptions |
1607
+
1608
+ This property is related to value update behaviors.
1609
+
1610
+ [Learn more](https://react-hook-form.com/docs/useform#resetOptions)
1611
+
1612
+ UseFormProps\['resetOptions'\]
1613
+
1614
+ | \- | Set object |
1615
+ | resolver |
1616
+
1617
+ This function allows you to use any external validation library such as Yup, Zod, Joi, Vest, Ajv and many others.
1618
+
1619
+ [Learn more](https://react-hook-form.com/docs/useform#resolver)
1620
+
1621
+ UseFormProps\['resolver'\]
1622
+
1623
+ | \- | Set object |
1624
+ | reValidateMode |
1625
+
1626
+ Configure validation strategy when inputs with errors get re-validated **after** a user submits the form.
1627
+
1628
+ [Learn more](https://react-hook-form.com/docs/useform#reValidateMode)
1629
+
1630
+ UseFormProps\['reValidateMode'\]
1631
+
1632
+ |
1633
+
1634
+ 'onChange'
1635
+
1636
+ | Set object |
1637
+ | shouldFocusError |
1638
+
1639
+ When set to true, and the user submits a form that fails validation, focus is set on the first field with an error. By default, it is set based on the `hiddenErrorSummary` prop.
1640
+
1641
+ * If hiddenErrorSummary is true, it will focus on the first field with an error.
1642
+ * If hiddenErrorSummary is false, it will focus on the error summary.
919
1643
 
920
- Copy
1644
+ [Learn more](https://react-hook-form.com/docs/useform#shouldFocusError)
921
1645
 
922
- ### [](#handling-submission)Handling submission
1646
+ UseFormProps\['shouldFocusError'\]
1647
+
1648
+ | \- | Set object |
1649
+ | shouldUnregister |
1650
+
1651
+ By default, an input value will be retained when input is removed. However, you can set `shouldUnregister` to `true` to `unregister` input during unmount.
1652
+
1653
+ [Learn more](https://react-hook-form.com/docs/useform#shouldUnregister)
1654
+
1655
+ UseFormProps\['shouldUnregister'\]
1656
+
1657
+ | \- | Set object |
1658
+ | shouldUseNativeValidation |
1659
+
1660
+ This config will enable browser native validation. It will also enable CSS selectors :valid and:invalid making styling inputs easier.
1661
+
1662
+ [Learn more](https://react-hook-form.com/docs/useform#shouldUseNativeValidation)
1663
+
1664
+ UseFormProps\['shouldUseNativeValidation'\]
1665
+
1666
+ | \- | Set object |
1667
+ | values |
1668
+
1669
+ The values prop will react to changes and update the form values, which is useful when your form needs to be updated by external state or server data.
1670
+
1671
+ [Learn more](https://react-hook-form.com/docs/useform#values)
1672
+
1673
+ UseFormProps\['values'\]
1674
+
1675
+ | \- | Set object |
1676
+ | Show Storybook only itemsStorybook only | Show Storybook only items |
1677
+
1678
+ ### Handling submission
923
1679
 
924
1680
  When the form passes validation (if not disabled), the `onSubmit` event is emitted. Its event details contain a map of the field names and the data entered by the user.
925
1681
 
1682
+ [](./iframe.html?id=components-form--handling-submission)
1683
+
926
1684
  \*Required Name
927
1685
 
928
1686
  \*Required Email address
929
1687
 
930
1688
  Sign up
931
1689
 
932
- Hide code
933
-
934
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
1690
+ ```
935
1691
 
936
1692
  import {
937
1693
  IressTable,
938
- IressFormProps,
1694
+ type IressFormProps,
939
1695
  IressForm,
940
1696
  IressModal,
941
1697
  IressFormField,
@@ -994,12 +1750,49 @@ export const FormSubmission \= () \=> {
994
1750
  );
995
1751
  };
996
1752
 
997
- Copy
1753
+ ```
1754
+
1755
+ #### Props
1756
+
1757
+ | Name | Description | Default | Control |
1758
+ | --- | --- | --- | --- |
1759
+ | alert |
1760
+ \-
1761
+
1762
+ | \- | Choose option...nonebasicAlert |
1763
+ | children |
1764
+
1765
+ object
1766
+
1767
+
1768
+
1769
+ | \- | \- |
1770
+ | form |
1771
+
1772
+ React hook form instance from `useForm`, use if you need more control over the internal state.
1773
+
1774
+ const form = useForm();
1775
+ return <IressForm form={form} />;
1776
+
1777
+
1778
+ UseFormReturn
1779
+
998
1780
 
999
- ### [](#read-only)Read only
1781
+
1782
+ | \- | Set object |
1783
+ | onSubmit |
1784
+
1785
+ \-
1786
+
1787
+ | \- | \- |
1788
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
1789
+
1790
+ ### Read only
1000
1791
 
1001
1792
  You can pass the `readOnly` prop to remove the asterisk symbol (\*) even when the field is `required`, and that field will be exempted from validation.
1002
1793
 
1794
+ [](./iframe.html?id=components-form--exclude-read-only-validation)
1795
+
1003
1796
  Try hitting submit to see the validation summary: only email is being validated
1004
1797
  -------------------------------------------------------------------------------
1005
1798
 
@@ -1011,14 +1804,12 @@ Luke Skywalker
1011
1804
 
1012
1805
  Sign up
1013
1806
 
1014
- Hide code
1015
-
1016
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
1807
+ ```
1017
1808
 
1018
1809
  <IressStack gutter\="md"\>
1019
1810
  <IressText element\="h2"\>
1020
1811
  Try hitting submit to see the validation summary: only email is being validated </IressText\>
1021
- <IressForm\>
1812
+ <ForwardedForm\>
1022
1813
  <IressStack gutter\="md"\>
1023
1814
  <IressFormField
1024
1815
  label\="Name"
@@ -1047,13 +1838,43 @@ Hide code
1047
1838
  \>
1048
1839
  Sign up </IressButton\>
1049
1840
  </IressStack\>
1050
- </IressForm\>
1841
+ </ForwardedForm\>
1051
1842
  </IressStack\>
1052
1843
 
1053
- Copy
1844
+ ```
1845
+
1846
+ #### Props
1847
+
1848
+ | Name | Description | Default | Control |
1849
+ | --- | --- | --- | --- |
1850
+ | alert |
1851
+ \-
1852
+
1853
+ | \- | Choose option...nonebasicAlert |
1854
+ | children |
1855
+
1856
+ object
1857
+
1858
+
1054
1859
 
1055
- [](#behaviour)Behaviour
1056
- -----------------------
1860
+ | \- | Choose option...nonesimplesupportedControlsreadOnly |
1861
+ | form |
1862
+
1863
+ React hook form instance from `useForm`, use if you need more control over the internal state.
1864
+
1865
+ const form = useForm();
1866
+ return <IressForm form={form} />;
1867
+
1868
+
1869
+ UseFormReturn
1870
+
1871
+
1872
+
1873
+ | \- | Set object |
1874
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
1875
+
1876
+ Behaviour
1877
+ ---------
1057
1878
 
1058
1879
  * Initial form validation is done when the user first submits the form. This allows them to focus on entering data without being overwhelmed by validation errors.
1059
1880
  * If there are validation errors on submission, they will be shown at the form level as a summary, as well as per field. Only the first failing error will be displayed per field.
@@ -1061,13 +1882,15 @@ Copy
1061
1882
 
1062
1883
  **Note:** The default user experience regarding validation is different to previous versions of IDS. This change was done to align IDS with the typical user experience found in other applications. If you would like to change the behaviour to be more consistent with the original IDS, set the `mode` prop of the form to `onBlur`.
1063
1884
 
1064
- [](#examples)Examples
1065
- ---------------------
1885
+ Examples
1886
+ --------
1066
1887
 
1067
- ### [](#validation-summary)Validation summary
1888
+ ### Validation summary
1068
1889
 
1069
1890
  If errors are present, they are displayed in a summary at the top of the page. This can be customised using the `errorSummaryHeading` prop.
1070
1891
 
1892
+ [](./iframe.html?id=components-form--validation-summary)
1893
+
1071
1894
  Try hitting submit to see the validation summary
1072
1895
  ------------------------------------------------
1073
1896
 
@@ -1077,14 +1900,12 @@ Try hitting submit to see the validation summary
1077
1900
 
1078
1901
  Sign up
1079
1902
 
1080
- Hide code
1081
-
1082
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
1903
+ ```
1083
1904
 
1084
1905
  <IressStack gutter\="md"\>
1085
1906
  <IressText element\="h2"\>
1086
1907
  Try hitting submit to see the validation summary </IressText\>
1087
- <IressForm errorSummaryHeading\="We have seen the following errors in your submission..."\>
1908
+ <ForwardedForm errorSummaryHeading\="We have seen the following errors in your submission..."\>
1088
1909
  <IressStack gutter\="md"\>
1089
1910
  <IressFormField
1090
1911
  label\="Name"
@@ -1112,15 +1933,54 @@ Hide code
1112
1933
  \>
1113
1934
  Sign up </IressButton\>
1114
1935
  </IressStack\>
1115
- </IressForm\>
1936
+ </ForwardedForm\>
1116
1937
  </IressStack\>
1117
1938
 
1118
- Copy
1939
+ ```
1940
+
1941
+ #### Props
1942
+
1943
+ | Name | Description | Default | Control |
1944
+ | --- | --- | --- | --- |
1945
+ | alert |
1946
+ \-
1119
1947
 
1120
- ### [](#hidden-validation-summary)Hidden validation summary
1948
+ | \- | Choose option...nonebasicAlert |
1949
+ | children |
1950
+
1951
+ object
1952
+
1953
+
1954
+
1955
+ | \- | Choose option...nonesimplesupportedControlsreadOnly |
1956
+ | errorSummaryHeading |
1957
+
1958
+ string
1959
+
1960
+
1961
+
1962
+ | \- | We have seen the following errors in your submission... |
1963
+ | form |
1964
+
1965
+ React hook form instance from `useForm`, use if you need more control over the internal state.
1966
+
1967
+ const form = useForm();
1968
+ return <IressForm form={form} />;
1969
+
1970
+
1971
+ UseFormReturn
1972
+
1973
+
1974
+
1975
+ | \- | Set object |
1976
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
1977
+
1978
+ ### Hidden validation summary
1121
1979
 
1122
1980
  Use the `hiddenErrorSummary` prop to hide the summary altogether, and only show the errors on the fields. This is only recommended for short forms, for long forms it is recommended to keep the error summary shown for best accessibility.
1123
1981
 
1982
+ [](./iframe.html?id=components-form--hidden-error-summary)
1983
+
1124
1984
  Try hitting submit to see the errors only on the fields
1125
1985
  -------------------------------------------------------
1126
1986
 
@@ -1130,14 +1990,12 @@ Try hitting submit to see the errors only on the fields
1130
1990
 
1131
1991
  Sign up
1132
1992
 
1133
- Hide code
1134
-
1135
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
1993
+ ```
1136
1994
 
1137
1995
  <IressStack gutter\="md"\>
1138
1996
  <IressText element\="h2"\>
1139
1997
  Try hitting submit to see the errors only on the fields </IressText\>
1140
- <IressForm hiddenErrorSummary\>
1998
+ <ForwardedForm hiddenErrorSummary\>
1141
1999
  <IressStack gutter\="md"\>
1142
2000
  <IressFormField
1143
2001
  label\="Name"
@@ -1165,30 +2023,67 @@ Hide code
1165
2023
  \>
1166
2024
  Sign up </IressButton\>
1167
2025
  </IressStack\>
1168
- </IressForm\>
2026
+ </ForwardedForm\>
1169
2027
  </IressStack\>
1170
2028
 
1171
- Copy
2029
+ ```
2030
+
2031
+ #### Props
2032
+
2033
+ | Name | Description | Default | Control |
2034
+ | --- | --- | --- | --- |
2035
+ | alert |
2036
+ \-
2037
+
2038
+ | \- | Choose option...nonebasicAlert |
2039
+ | children |
2040
+
2041
+ object
2042
+
2043
+
2044
+
2045
+ | \- | Choose option...nonesimplesupportedControlsreadOnly |
2046
+ | form |
2047
+
2048
+ React hook form instance from `useForm`, use if you need more control over the internal state.
2049
+
2050
+ const form = useForm();
2051
+ return <IressForm form={form} />;
2052
+
2053
+
2054
+ UseFormReturn
2055
+
2056
+
2057
+
2058
+ | \- | Set object |
2059
+ | hiddenErrorSummary |
2060
+
2061
+ boolean
1172
2062
 
1173
- ### [](#custom-error-handling)Custom error handling
2063
+
2064
+
2065
+ | \- | FalseTrue |
2066
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
2067
+
2068
+ ### Custom error handling
1174
2069
 
1175
2070
  The `onError` prop allows you to listen to any field errors. It takes two arguments. The first is a map of the field name and an object containing the first error message and type. The second is a ref to the original element that caused the error (the ref of the underlying input).
1176
2071
 
1177
2072
  One use case for this prop is to create your own error summary.
1178
2073
 
2074
+ [](./iframe.html?id=components-form--custom-error-handling)
2075
+
1179
2076
  \*Required Name
1180
2077
 
1181
2078
  \*Required Email address
1182
2079
 
1183
2080
  Sign up
1184
2081
 
1185
- Hide code
1186
-
1187
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
2082
+ ```
1188
2083
 
1189
2084
  import {
1190
2085
  IressTable,
1191
- IressFormProps,
2086
+ type IressFormProps,
1192
2087
  IressForm,
1193
2088
  IressModal,
1194
2089
  IressStack,
@@ -1197,7 +2092,7 @@ import {
1197
2092
  IressButton,
1198
2093
  } from '@iress-oss/ids-components';
1199
2094
  import { useState } from 'react';
1200
- import { FieldErrors } from 'react-hook-form';
2095
+ import { type FieldErrors } from 'react-hook-form';
1201
2096
  interface FieldValues {
1202
2097
  name?: string;
1203
2098
  email?: string;
@@ -1257,23 +2152,65 @@ export const CustomErrorHandlingForm \= () \=> {
1257
2152
  );
1258
2153
  };
1259
2154
 
1260
- Copy
2155
+ ```
2156
+
2157
+ #### Props
2158
+
2159
+ | Name | Description | Default | Control |
2160
+ | --- | --- | --- | --- |
2161
+ | alert |
2162
+ \-
2163
+
2164
+ | \- | Choose option...nonebasicAlert |
2165
+ | children |
2166
+
2167
+ object
2168
+
2169
+
2170
+
2171
+ | \- | \- |
2172
+ | form |
2173
+
2174
+ React hook form instance from `useForm`, use if you need more control over the internal state.
2175
+
2176
+ const form = useForm();
2177
+ return <IressForm form={form} />;
2178
+
2179
+
2180
+ UseFormReturn
2181
+
1261
2182
 
1262
- ### [](#pre-fill-the-form)Pre-fill the form
2183
+
2184
+ | \- | Set object |
2185
+ | hiddenErrorSummary |
2186
+
2187
+ boolean
2188
+
2189
+
2190
+
2191
+ | \- | FalseTrue |
2192
+ | onError |
2193
+
2194
+ \-
2195
+
2196
+ | \- | \- |
2197
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
2198
+
2199
+ ### Pre-fill the form
1263
2200
 
1264
2201
  You can set the `defaultValues` prop to pre-fill the form values.
1265
2202
 
2203
+ [](./iframe.html?id=components-form--default-values)
2204
+
1266
2205
  \*Required Name
1267
2206
 
1268
2207
  \*Required Email address
1269
2208
 
1270
2209
  Sign up
1271
2210
 
1272
- Hide code
1273
-
1274
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
2211
+ ```
1275
2212
 
1276
- <IressForm
2213
+ <ForwardedForm
1277
2214
  defaultValues\={{
1278
2215
  email: 'luke.skywalker@iress.com',
1279
2216
  name: 'Luke Skywalker'
@@ -1306,11 +2243,41 @@ Hide code
1306
2243
  \>
1307
2244
  Sign up </IressButton\>
1308
2245
  </IressStack\>
1309
- </IressForm\>
2246
+ </ForwardedForm\>
2247
+
2248
+ ```
2249
+
2250
+ #### Props
2251
+
2252
+ | Name | Description | Default | Control |
2253
+ | --- | --- | --- | --- |
2254
+ | alert |
2255
+ \-
2256
+
2257
+ | \- | Choose option...nonebasicAlert |
2258
+ | children |
2259
+
2260
+ object
2261
+
1310
2262
 
1311
- Copy
1312
2263
 
1313
- ### [](#values)`values`
2264
+ | \- | Choose option...nonesimplesupportedControlsreadOnly |
2265
+ | form |
2266
+
2267
+ React hook form instance from `useForm`, use if you need more control over the internal state.
2268
+
2269
+ const form = useForm();
2270
+ return <IressForm form={form} />;
2271
+
2272
+
2273
+ UseFormReturn
2274
+
2275
+
2276
+
2277
+ | \- | Set object |
2278
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
2279
+
2280
+ ### `values`
1314
2281
 
1315
2282
  If you would like more control over each value of the form, you should use the `values` prop. This will make the form controlled, meaning it will rely completely on the `values` state to render the value of each field. You will need to use the `onSubmit` prop to sync the form value with your state.
1316
2283
 
@@ -1321,6 +2288,8 @@ Use cases where you may need the `values` prop:
1321
2288
 
1322
2289
  **Note:** `values` takes precedence over `defaultValues`. To ensure your form state is predictable, it is best to only use one prop to manage form values.
1323
2290
 
2291
+ [](./iframe.html?id=components-form--values)
2292
+
1324
2293
  \*Required Name
1325
2294
 
1326
2295
  \*Required Email address
@@ -1331,9 +2300,7 @@ Sign up
1331
2300
 
1332
2301
  Last updateClear
1333
2302
 
1334
- Hide code
1335
-
1336
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
2303
+ ```
1337
2304
 
1338
2305
  interface FieldValues {
1339
2306
  name?: string;
@@ -1407,9 +2374,44 @@ export const ControlledForm \= (args: IressFormProps<FieldValues\>) \=> {
1407
2374
  );
1408
2375
  };
1409
2376
 
1410
- Copy
2377
+ ```
2378
+
2379
+ #### Props
2380
+
2381
+ | Name | Description | Default | Control |
2382
+ | --- | --- | --- | --- |
2383
+ | alert |
2384
+ \-
2385
+
2386
+ | \- | Choose option...nonebasicAlert |
2387
+ | children |
2388
+
2389
+ object
2390
+
2391
+
2392
+
2393
+ | \- | Choose option...nonesimplesupportedControlsreadOnly |
2394
+ | form |
1411
2395
 
1412
- ### [](#disable-validation)Disable validation
2396
+ React hook form instance from `useForm`, use if you need more control over the internal state.
2397
+
2398
+ const form = useForm();
2399
+ return <IressForm form={form} />;
2400
+
2401
+
2402
+ UseFormReturn
2403
+
2404
+
2405
+
2406
+ | \- | Set object |
2407
+ | onSubmit |
2408
+
2409
+ \-
2410
+
2411
+ | \- | \- |
2412
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
2413
+
2414
+ ### Disable validation
1413
2415
 
1414
2416
  Disabling validation is not possible with the `IressForm` component. In cases where you do need to disable validation, please consider the following:
1415
2417
 
@@ -1418,6 +2420,8 @@ Disabling validation is not possible with the `IressForm` component. In cases wh
1418
2420
 
1419
2421
  Here we have an example showcasing option one.
1420
2422
 
2423
+ [](./iframe.html?id=components-form--disable-validation)
2424
+
1421
2425
  \*Required Name
1422
2426
 
1423
2427
  \*Required Email address
@@ -1428,17 +2432,15 @@ Sign up
1428
2432
 
1429
2433
  Save as draft
1430
2434
 
1431
- Hide code
1432
-
1433
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
2435
+ ```
1434
2436
 
1435
2437
  import {
1436
- FormRef,
2438
+ type FormRef,
1437
2439
  IressButton,
1438
2440
  IressDivider,
1439
2441
  IressForm,
1440
2442
  IressFormField,
1441
- IressFormProps,
2443
+ type IressFormProps,
1442
2444
  IressInput,
1443
2445
  IressStack,
1444
2446
  IressToasterProvider,
@@ -1514,14 +2516,56 @@ export const DisableValidationForm \= () \=> (
1514
2516
  </IressToasterProvider\>
1515
2517
  );
1516
2518
 
1517
- Copy
2519
+ ```
2520
+
2521
+ #### Props
2522
+
2523
+ | Name | Description | Default | Control |
2524
+ | --- | --- | --- | --- |
2525
+ | alert |
2526
+ \-
2527
+
2528
+ | \- | Choose option...nonebasicAlert |
2529
+ | children |
2530
+
2531
+ object
2532
+
2533
+
1518
2534
 
1519
- ### [](#resetting-the-form)Resetting the form
2535
+ | \- | \- |
2536
+ | form |
2537
+
2538
+ React hook form instance from `useForm`, use if you need more control over the internal state.
2539
+
2540
+ const form = useForm();
2541
+ return <IressForm form={form} />;
2542
+
2543
+
2544
+ UseFormReturn
2545
+
2546
+
2547
+
2548
+ | \- | Set object |
2549
+ | onError |
2550
+
2551
+ \-
2552
+
2553
+ | \- | \- |
2554
+ | onSubmit |
2555
+
2556
+ \-
2557
+
2558
+ | \- | \- |
2559
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
2560
+
2561
+ ### Resetting the form
1520
2562
 
1521
2563
  You can reset the form using the `ref` of the form. You must provide a `defaultValues` prop that contains all the fields in the form to ensure it resets properly.
1522
2564
 
1523
2565
  **Note:** `<button type="reset" />` does not work with `IressForm`. You need to add an `onClick` prop to the button and use the `ref.reset` method to reset the form.
1524
2566
 
2567
+ [](./iframe.html?id=components-form--reset-form)
2568
+
1525
2569
  \*Required Name
1526
2570
 
1527
2571
  \*Required Email address
@@ -1532,14 +2576,12 @@ Sign up
1532
2576
 
1533
2577
  Reset
1534
2578
 
1535
- Hide code
1536
-
1537
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
2579
+ ```
1538
2580
 
1539
2581
  import {
1540
- IressFormProps,
2582
+ type IressFormProps,
1541
2583
  IressForm,
1542
- FormRef,
2584
+ type FormRef,
1543
2585
  IressDivider,
1544
2586
  IressButton,
1545
2587
  IressStack,
@@ -1591,9 +2633,39 @@ export const FormReset \= () \=> {
1591
2633
  );
1592
2634
  };
1593
2635
 
1594
- Copy
2636
+ ```
2637
+
2638
+ #### Props
2639
+
2640
+ | Name | Description | Default | Control |
2641
+ | --- | --- | --- | --- |
2642
+ | alert |
2643
+ \-
2644
+
2645
+ | \- | Choose option...nonebasicAlert |
2646
+ | children |
1595
2647
 
1596
- ### [](#custom-form-field-components)Custom form field components
2648
+ object
2649
+
2650
+
2651
+
2652
+ | \- | \- |
2653
+ | form |
2654
+
2655
+ React hook form instance from `useForm`, use if you need more control over the internal state.
2656
+
2657
+ const form = useForm();
2658
+ return <IressForm form={form} />;
2659
+
2660
+
2661
+ UseFormReturn
2662
+
2663
+
2664
+
2665
+ | \- | Set object |
2666
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
2667
+
2668
+ ### Custom form field components
1597
2669
 
1598
2670
  You can integrate custom components within `IressFormField` to create enhanced form experiences.
1599
2671
 
@@ -1612,6 +2684,8 @@ Key features demonstrated:
1612
2684
  * **Form State Management**: Automatically integrates with form context using controlled props
1613
2685
  * **File Management**: Display uploaded files with remove functionality using `IressPanel`
1614
2686
 
2687
+ [](./iframe.html?id=components-form--custom-form-field-components)
2688
+
1615
2689
  Custom FormField Components
1616
2690
  ===========================
1617
2691
 
@@ -1625,9 +2699,7 @@ Upload
1625
2699
 
1626
2700
  Submit
1627
2701
 
1628
- Hide code
1629
-
1630
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
2702
+ ```
1631
2703
 
1632
2704
  import React, { useState } from 'react';
1633
2705
 
@@ -1736,7 +2808,7 @@ const TranscriptTextBox \= ({
1736
2808
  reader.readAsText(file);
1737
2809
  };
1738
2810
  const handleTextChange \= (
1739
- e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement\>,
2811
+ \_e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement\>,
1740
2812
  textContent: string,
1741
2813
  ) \=> {
1742
2814
  onChange(createTranscriptData(textContent, 'text'));
@@ -1918,25 +2990,55 @@ export const CustomFormFieldComponents \= (
1918
2990
  );
1919
2991
  };
1920
2992
 
1921
- Copy
2993
+ ```
2994
+
2995
+ #### Props
2996
+
2997
+ | Name | Description | Default | Control |
2998
+ | --- | --- | --- | --- |
2999
+ | alert |
3000
+ \-
3001
+
3002
+ | \- | Choose option...nonebasicAlert |
3003
+ | children |
3004
+
3005
+ object
1922
3006
 
1923
- ### [](#forms-in-expanders-lazy-loading)Forms in expanders (lazy loading)
3007
+
3008
+
3009
+ | \- | \- |
3010
+ | form |
3011
+
3012
+ React hook form instance from `useForm`, use if you need more control over the internal state.
3013
+
3014
+ const form = useForm();
3015
+ return <IressForm form={form} />;
3016
+
3017
+
3018
+ UseFormReturn
3019
+
3020
+
3021
+
3022
+ | \- | \- |
3023
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
3024
+
3025
+ ### Forms in expanders (lazy loading)
1924
3026
 
1925
3027
  If you are using forms in expanders, or in other scenarios when the loading of the form may be delayed, it is recommended to only load the form when it is required. This will improve performance of your application, and make it more predictable. It may also fix act warnings in tests if you are seeing some appearing due to conditionally loaded `IressForm` elements.
1926
3028
 
3029
+ [](./iframe.html?id=components-form--forms-in-expanders)
3030
+
1927
3031
  Sender
1928
3032
 
1929
3033
  Recipient
1930
3034
 
1931
- Hide code
1932
-
1933
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
3035
+ ```
1934
3036
 
1935
3037
  import {
1936
3038
  IressExpander,
1937
3039
  IressForm,
1938
3040
  IressFormField,
1939
- IressFormProps,
3041
+ type IressFormProps,
1940
3042
  IressInput,
1941
3043
  IressStack,
1942
3044
  } from '@iress-oss/ids-components';
@@ -1994,9 +3096,39 @@ export const FormExpanders \= () \=> {
1994
3096
  );
1995
3097
  };
1996
3098
 
1997
- Copy
3099
+ ```
3100
+
3101
+ #### Props
3102
+
3103
+ | Name | Description | Default | Control |
3104
+ | --- | --- | --- | --- |
3105
+ | alert |
3106
+ \-
3107
+
3108
+ | \- | Choose option...nonebasicAlert |
3109
+ | children |
3110
+
3111
+ object
3112
+
1998
3113
 
1999
- ### [](#conditional-fields-usewatch)Conditional fields (useWatch)
3114
+
3115
+ | \- | \- |
3116
+ | form |
3117
+
3118
+ React hook form instance from `useForm`, use if you need more control over the internal state.
3119
+
3120
+ const form = useForm();
3121
+ return <IressForm form={form} />;
3122
+
3123
+
3124
+ UseFormReturn
3125
+
3126
+
3127
+
3128
+ | \- | Set object |
3129
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
3130
+
3131
+ ### Conditional fields (useWatch)
2000
3132
 
2001
3133
  When you have fields that are conditionally shown, you can use the `IressForm.useWatch` hook to watch the value of another field and conditionally render the field.
2002
3134
 
@@ -2004,6 +3136,8 @@ When you have fields that are conditionally shown, you can use the `IressForm.us
2004
3136
 
2005
3137
  * You can use the `api.watch` method on the `IressForm`'s ref to watch the value of a field, but it is recommended to use the hook for better performance by isolating re-rendering at the component level.
2006
3138
 
3139
+ [](./iframe.html?id=components-form--use-watch)
3140
+
2007
3141
  This is a conditional field example using "useWatch".
2008
3142
 
2009
3143
  \*Required Select fields to show
@@ -2016,9 +3150,7 @@ Email
2016
3150
 
2017
3151
  Submit
2018
3152
 
2019
- Hide code
2020
-
2021
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
3153
+ ```
2022
3154
 
2023
3155
  import {
2024
3156
  IressButton,
@@ -2027,7 +3159,7 @@ import {
2027
3159
  IressDivider,
2028
3160
  IressForm,
2029
3161
  IressFormField,
2030
- IressFormProps,
3162
+ type IressFormProps,
2031
3163
  IressInput,
2032
3164
  IressStack,
2033
3165
  IressText,
@@ -2097,10 +3229,40 @@ export const UseWatchForm \= () \=> (
2097
3229
  </IressForm\>
2098
3230
  );
2099
3231
 
2100
- Copy
3232
+ ```
3233
+
3234
+ #### Props
3235
+
3236
+ | Name | Description | Default | Control |
3237
+ | --- | --- | --- | --- |
3238
+ | alert |
3239
+ \-
3240
+
3241
+ | \- | Choose option...nonebasicAlert |
3242
+ | children |
3243
+
3244
+ object
3245
+
3246
+
2101
3247
 
2102
- [](#iresshookform)`IressHookForm`
2103
- ---------------------------------
3248
+ | \- | Choose option...nonesimplesupportedControlsreadOnly |
3249
+ | form |
3250
+
3251
+ React hook form instance from `useForm`, use if you need more control over the internal state.
3252
+
3253
+ const form = useForm();
3254
+ return <IressForm form={form} />;
3255
+
3256
+
3257
+ UseFormReturn
3258
+
3259
+
3260
+
3261
+ | \- | Set object |
3262
+ | Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
3263
+
3264
+ `IressHookForm`
3265
+ ---------------
2104
3266
 
2105
3267
  `IressHookForm` is the underlying component that `IressForm` is built upon. It has a single required prop, `form`, which expects the return value of the `useForm` hook from React Hook Forms.
2106
3268
 
@@ -2111,15 +3273,15 @@ Some use cases:
2111
3273
  1. You may need to use the `useForm` hook in a parent component to share the form state with multiple child components.
2112
3274
  2. You would like to use the return value of the `useForm` hook without having to use a ref to access the `react-hook-form` api.
2113
3275
 
3276
+ [](./iframe.html?id=components-form--hook-form)
3277
+
2114
3278
  \*Required First Name
2115
3279
 
2116
3280
  \*Required Last Name
2117
3281
 
2118
3282
  Submit
2119
3283
 
2120
- Hide code
2121
-
2122
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
3284
+ ```
2123
3285
 
2124
3286
  interface FieldValues {
2125
3287
  firstName: string;
@@ -2158,10 +3320,128 @@ export const HookFormExample \= () \=> {
2158
3320
  );
2159
3321
  };
2160
3322
 
2161
- Copy
3323
+ ```
3324
+
3325
+ #### Props
3326
+
3327
+ | Name | Description | Default | Control |
3328
+ | --- | --- | --- | --- |
3329
+ | alert |
3330
+ Section to place error summary when the app is in control of validation.
3331
+
3332
+ ReactReactNode
3333
+
3334
+
3335
+
3336
+ | \- | Set object |
3337
+ | children |
3338
+
3339
+ The content of the form, usually multiple `IressFormField` or `IressFormFieldset` components.
3340
+
3341
+ ReactReactNode
3342
+
3343
+
3344
+
3345
+ | \- | Set object |
3346
+ | errorSummaryHeading |
3347
+
3348
+ Content to be displayed in the title of the error summary.
3349
+
3350
+ ReactNode
3351
+
3352
+
3353
+
3354
+ | <h3>There was a problem submitting this form</h3> | Set object |
3355
+ | errorSummaryHeadingLevel |
3356
+
3357
+ Level of error summary heading for semantics.
3358
+
3359
+ HeadingLevel
3360
+
3361
+ <table class="css-3nr4py"><tbody><tr><td colspan="2"><strong>Deprecated</strong>: Use errorSummaryHeading instead.</td></tr></tbody></table>
3362
+
3363
+ | \- | Set object |
3364
+ | errorSummaryHeadingText |
3365
+
3366
+ Text to be displayed in the title of the error summary.
3367
+
3368
+ string
2162
3369
 
2163
- [](#migration-to-version-5)Migration to version 5
2164
- -------------------------------------------------
3370
+ <table class="css-3nr4py"><tbody><tr><td colspan="2"><strong>Deprecated</strong>: Use errorSummaryHeading instead.</td></tr></tbody></table>
3371
+
3372
+ | \- | Set string |
3373
+ | form\* |
3374
+
3375
+ React hook form instance.
3376
+
3377
+ UseFormReturn
3378
+
3379
+
3380
+
3381
+ | \- | Set object |
3382
+ | gutter |
3383
+
3384
+ Sets the amount of spacing between the heading, alert, children and footer.
3385
+
3386
+ union
3387
+
3388
+
3389
+
3390
+ |
3391
+
3392
+ 'lg'
3393
+
3394
+ | Set object |
3395
+ | hiddenErrorSummary |
3396
+
3397
+ Sets which of the block / inline layout options apply.
3398
+
3399
+ boolean
3400
+
3401
+
3402
+
3403
+ | \- | Set boolean |
3404
+ | onError |
3405
+
3406
+ Emitted when any field has an error. Called after the first submit if any errors are recorded, and from then on when any value changes.
3407
+
3408
+ [Learn more](https://react-hook-form.com/docs/useform/handlesubmit)
3409
+
3410
+ SubmitErrorHandler
3411
+
3412
+
3413
+
3414
+ | \- | Set object |
3415
+ | onSubmit |
3416
+
3417
+ Handler for when the submit method on the form is called after validation is passed.
3418
+
3419
+ [Learn more](https://react-hook-form.com/docs/useform/handlesubmit)
3420
+
3421
+ (data: T) => void
3422
+
3423
+ | \- | \- |
3424
+ | onValidChange |
3425
+
3426
+ Emitted when the form state is valid.
3427
+
3428
+ [Learn more](https://react-hook-form.com/docs/useform/formstate)
3429
+
3430
+ (isValid: boolean) => void
3431
+
3432
+ | \- | \- |
3433
+ | updateErrorSummaryOnSubmit |
3434
+
3435
+ If set to `true`, the summary will only update when the form is submitted, not on every field change. This is useful for performance reasons, especially in large forms.
3436
+
3437
+ boolean
3438
+
3439
+
3440
+
3441
+ | \- | Set boolean |
3442
+
3443
+ Migration to version 5
3444
+ ----------------------
2165
3445
 
2166
3446
  The previous form components contained a lot of logic to translate the HTML5 validation API to a format that matched the design system’s guidelines. This allowed users to use the default props of input such as `pattern` and `required`, and be assured that the `IressField` would display errors accordingly.
2167
3447
 
@@ -2173,30 +3453,13 @@ The validation logic has been stripped from all of the existing form components.
2173
3453
 
2174
3454
  Automated validation is now solely contained in `IressForm` and `IressFormField`, using [React Hook Form](https://react-hook-form.com/docs/useform) under the hood to simplify maintenance.
2175
3455
 
2176
- [](#testing)Testing
2177
- -------------------
3456
+ Testing
3457
+ -------
2178
3458
 
2179
3459
  Unfortunately due to the asynchronous nature of React Hook Form validation, `IressForm` still needs to be tested using `screen.findBy` queries (at least in the first query after render). If `findBy` is not used, you will start to see the dreaded `act warnings`. For more information on testing IressForm, please refer to the (React Hook Form testing documentation)\[[https://react-hook-form.com/advanced-usage#TestingForm](https://react-hook-form.com/advanced-usage#TestingForm)\]
2180
3460
 
2181
3461
  Here is an example of testing a form submission.
2182
3462
 
2183
- \[data-radix-scroll-area-viewport\] {
2184
- scrollbar-width: none;
2185
- -ms-overflow-style: none;
2186
- -webkit-overflow-scrolling: touch;
2187
- }
2188
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
2189
- display: none;
2190
- }
2191
- :where(\[data-radix-scroll-area-viewport\]) {
2192
- display: flex;
2193
- flex-direction: column;
2194
- align-items: stretch;
2195
- }
2196
- :where(\[data-radix-scroll-area-content\]) {
2197
- flex-grow: 1;
2198
- }
2199
-
2200
3463
  render(
2201
3464
  <IressForm\>
2202
3465
  <IressFormField
@@ -2221,34 +3484,17 @@ const summaryError \= await screen.findByText(
2221
3484
  );
2222
3485
  expect(summaryError).toBeInTheDocument();
2223
3486
 
2224
- Copy
3487
+ ```
2225
3488
 
2226
- [](#caveat)Caveat
2227
- -----------------
3489
+ Caveat
3490
+ ------
2228
3491
 
2229
- ### [](#using-iressselect-with-non-string-values-in-iressformfield)Using `IressSelect` with non-string values in `IressFormField`
3492
+ ### Using `IressSelect` with non-string values in `IressFormField`
2230
3493
 
2231
3494
  When using form controls that support non-string values (like `IressSelect` with number values), you might encounter type conflicts with React Hook Form's default event handling. By default, React Hook Form expects string values from form controls.
2232
3495
 
2233
3496
  **Problem:**
2234
3497
 
2235
- \[data-radix-scroll-area-viewport\] {
2236
- scrollbar-width: none;
2237
- -ms-overflow-style: none;
2238
- -webkit-overflow-scrolling: touch;
2239
- }
2240
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
2241
- display: none;
2242
- }
2243
- :where(\[data-radix-scroll-area-viewport\]) {
2244
- display: flex;
2245
- flex-direction: column;
2246
- align-items: stretch;
2247
- }
2248
- :where(\[data-radix-scroll-area-content\]) {
2249
- flex-grow: 1;
2250
- }
2251
-
2252
3498
  <IressFormField
2253
3499
  name\="dependents"
2254
3500
  label\="Dependents"
@@ -2264,29 +3510,12 @@ When using form controls that support non-string values (like `IressSelect` with
2264
3510
  )}
2265
3511
  />
2266
3512
 
2267
- Copy
3513
+ ```
2268
3514
 
2269
3515
  In this case, React Hook Form will try to convert the value to string, which might cause type issues.
2270
3516
 
2271
3517
  **Solution:** Override the `onChange` handler to pass the actual value as a second parameter:
2272
3518
 
2273
- \[data-radix-scroll-area-viewport\] {
2274
- scrollbar-width: none;
2275
- -ms-overflow-style: none;
2276
- -webkit-overflow-scrolling: touch;
2277
- }
2278
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
2279
- display: none;
2280
- }
2281
- :where(\[data-radix-scroll-area-viewport\]) {
2282
- display: flex;
2283
- flex-direction: column;
2284
- align-items: stretch;
2285
- }
2286
- :where(\[data-radix-scroll-area-content\]) {
2287
- flex-grow: 1;
2288
- }
2289
-
2290
3519
  <IressFormField
2291
3520
  name\="dependents"
2292
3521
  label\="Dependents"
@@ -2305,106 +3534,39 @@ In this case, React Hook Form will try to convert the value to string, which mig
2305
3534
  )}
2306
3535
  />
2307
3536
 
2308
- Copy
3537
+ ```
2309
3538
 
2310
3539
  This ensures the original value type is preserved when passed to React Hook Form. You can find out more about the code example in the [Switch Edit Readonly Form Documentation](?path=/docs/components-form-recipes--docs#switching-between-readonly-and-edit-modes).
2311
3540
 
2312
- ### [](#properly-resetting-fields)Properly resetting fields
3541
+ ### Properly resetting fields
2313
3542
 
2314
3543
  When resetting fields that accept non-string values (like `IressRichSelect`), you should reset them to `null` or `undefined` instead of an empty string. This is because the underlying component is strictly typed and expects a specific value type.
2315
3544
 
2316
3545
  **Problem:**
2317
3546
 
2318
- \[data-radix-scroll-area-viewport\] {
2319
- scrollbar-width: none;
2320
- -ms-overflow-style: none;
2321
- -webkit-overflow-scrolling: touch;
2322
- }
2323
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
2324
- display: none;
2325
- }
2326
- :where(\[data-radix-scroll-area-viewport\]) {
2327
- display: flex;
2328
- flex-direction: column;
2329
- align-items: stretch;
2330
- }
2331
- :where(\[data-radix-scroll-area-content\]) {
2332
- flex-grow: 1;
2333
- }
2334
-
2335
3547
  const { resetField } \= IressForm.useFormContext();
2336
3548
  resetField('rich-select', {
2337
3549
  label: '',
2338
3550
  value: '',
2339
3551
  });
2340
3552
 
2341
- Copy
3553
+ ```
2342
3554
 
2343
3555
  In this case, it will look like it cleared the field, but actually it has not. This is obvious with a `placeholder` set, as it will not show the placeholder.
2344
3556
 
2345
3557
  **Solution:** Override the `onChange` handler to pass the actual value as a second parameter:
2346
3558
 
2347
- \[data-radix-scroll-area-viewport\] {
2348
- scrollbar-width: none;
2349
- -ms-overflow-style: none;
2350
- -webkit-overflow-scrolling: touch;
2351
- }
2352
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
2353
- display: none;
2354
- }
2355
- :where(\[data-radix-scroll-area-viewport\]) {
2356
- display: flex;
2357
- flex-direction: column;
2358
- align-items: stretch;
2359
- }
2360
- :where(\[data-radix-scroll-area-content\]) {
2361
- flex-grow: 1;
2362
- }
2363
-
2364
3559
  const { resetField } \= IressForm.useFormContext();
2365
3560
  resetField('rich-select', null); // or undefined
2366
3561
 
2367
- Copy
3562
+ ```
2368
3563
 
2369
3564
  This will properly reset the field to null and clear the field value.
2370
3565
 
2371
- ### [](#conflicting-versions-of-react-hook-forms)Conflicting versions of React Hook Forms
3566
+ ### Conflicting versions of React Hook Forms
2372
3567
 
2373
3568
  If you are using React Hook Forms in your application, please ensure it is the same version IDS uses, otherwise there will be conflicts.
2374
3569
 
2375
3570
  The version we are using in IDS is:
2376
3571
 
2377
3572
  yarn add react-hook-form@7.53.1
2378
-
2379
- On this page
2380
-
2381
- * [Overview](#overview)
2382
- * [Props](#props)
2383
- * [Key concepts](#key-concepts)
2384
- * [State management](#state-management)
2385
- * [Validation](#validation)
2386
- * [Syncing state](#syncing-state)
2387
- * [Usage](#usage)
2388
- * [Fields](#fields)
2389
- * [Rules](#rules)
2390
- * [Handling submission](#handling-submission)
2391
- * [Read only](#read-only)
2392
- * [Behaviour](#behaviour)
2393
- * [Examples](#examples)
2394
- * [Validation summary](#validation-summary)
2395
- * [Hidden validation summary](#hidden-validation-summary)
2396
- * [Custom error handling](#custom-error-handling)
2397
- * [Pre-fill the form](#pre-fill-the-form)
2398
- * [values](#values)
2399
- * [Disable validation](#disable-validation)
2400
- * [Resetting the form](#resetting-the-form)
2401
- * [Custom form field components](#custom-form-field-components)
2402
- * [Forms in expanders (lazy loading)](#forms-in-expanders-lazy-loading)
2403
- * [Conditional fields (useWatch)](#conditional-fields-usewatch)
2404
- * [IressHookForm](#iresshookform)
2405
- * [Migration to version 5](#migration-to-version-5)
2406
- * [Testing](#testing)
2407
- * [Caveat](#caveat)
2408
- * [Using IressSelect with non-string values in IressFormField](#using-iressselect-with-non-string-values-in-iressformfield)
2409
- * [Properly resetting fields](#properly-resetting-fields)
2410
- * [Conflicting versions of React Hook Forms](#conflicting-versions-of-react-hook-forms)