Skip to content

Commit dfc294d

Browse files
committed
adds changeset
1 parent bcd6b01 commit dfc294d

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

.changeset/olive-bears-act.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
'@primer/react': major
3+
---
4+
5+
![image](https://user-images.githubusercontent.com/13340707/154948443-60d70cc7-4f26-444f-8366-7963336be53c.png)
6+
7+
The `FormControl` component will be used to deprecate the `FormGroup`, `InputField`, and `ChoiceInputField` components. It has the ability to render contextual content with your inputs: labels, validation statuses, captions. It also handles the ARIA attributes that make the form controls accessible to assistive technology.
8+
9+
<table>
10+
<tr>
11+
<th> Before </th> <th> After </th>
12+
</tr>
13+
<tr>
14+
<td valign="top">
15+
16+
```jsx
17+
import {FormControl, Checkbox, TextInput} from "@primer/react"
18+
19+
20+
<FormGroup>
21+
<FormGroup.Label htmlFor="example-text">Example text</FormGroup.Label>
22+
<TextInput id="example-text" />
23+
</FormGroup>
24+
25+
OR
26+
27+
<InputField>
28+
<InputField.Label>Example text</InputField.Label>
29+
<TextInput />
30+
</InputField>
31+
32+
OR
33+
34+
<ChoiceInputField>
35+
<ChoiceInputField.Label>Example text</ChoiceInputField.Label>
36+
<Checkbox />
37+
</ChoiceInputField>
38+
39+
```
40+
41+
</td>
42+
<td valign="top">
43+
44+
```jsx
45+
import {FormGroup, TextInput} from "@primer/react"
46+
47+
<FormControl>
48+
<FormControl.Label>Example text</FormControl.Label>
49+
<TextInput />
50+
</FormControl>
51+
52+
OR
53+
54+
<FormControl>
55+
<FormControl.Label>Example text</FormControl.Label>
56+
<Checkbox />
57+
</FormControl>
58+
59+
```
60+
61+
</td>
62+
</tr>
63+
<tr>
64+
<td valign="top">
65+
66+
```jsx
67+
import {InputField} from '@primer/react'
68+
69+
;<InputField>
70+
<InputField.Label>Example text</InputField.Label>
71+
<TextInput />
72+
</InputField>
73+
```
74+
75+
</td>
76+
<td valign="top">
77+
78+
```jsx
79+
import {FormControl} from '@primer/react'
80+
81+
;<FormControl>
82+
<FormControl.Label>Example Text</FormControl.Label>
83+
<TextInput />
84+
</FormControl>
85+
```
86+
87+
</td>
88+
</tr>
89+
</table>
90+
<table style="display: table">
91+
<tr><th>Migration steps to FormControl</th></tr>
92+
<tr>
93+
<td>
94+
95+
<strong>Upgrade to the new</strong> `FormControl` component by referring to the [examples in our documentation](https://primer.style/react/FormControl).
96+
97+
or
98+
99+
<strong>Continue using the deprecated</strong> `FormGroup`, `ChoiceInputField` or `InputField` :
100+
101+
```js
102+
import {FormGroup, ChoiceInputField, InputField} from '@primer/react/deprecated' // change your import statements
103+
```
104+
105+
</td>
106+
</tr>
107+
</table>

0 commit comments

Comments
 (0)