diff --git a/.changeset/heavy-points-marry.md b/.changeset/heavy-points-marry.md index 441a441f09f..e2ab675ccde 100644 --- a/.changeset/heavy-points-marry.md +++ b/.changeset/heavy-points-marry.md @@ -24,24 +24,36 @@ If you were using the `Label` component to render issue/PR labels, use the [Issu ```jsx -import {Label} from "@primer/react" - -<> - - - +import {Label} from '@primer/react' + +function Example() { + return ( + <> + + + + ) +} ``` ```jsx -import {Label} from "@primer/react" - -<> - - - +import {Label} from '@primer/react' + +function Example() { + return ( + <> + + + + ) +} ``` diff --git a/.changeset/many-roses-hammer.md b/.changeset/many-roses-hammer.md index af4480c795c..f7c3d5ae467 100644 --- a/.changeset/many-roses-hammer.md +++ b/.changeset/many-roses-hammer.md @@ -18,52 +18,40 @@ We now support a variant property which takes values `primary`, `invisible`, `ou - -```jsx -import { ButtonPrimary, ButtonInvisible, -ButtonOutline, ButtonDanger } -from '@primer/react' - -<> - - Primary Button - - - Invisible Button - - - Outline Button - - - Danger Button - - +```jsx +import {ButtonPrimary, ButtonInvisible, ButtonOutline, ButtonDanger} from '@primer/react' + +function Example() { + return ( + <> + Primary Button + Invisible Button + Outline Button + Danger Button + + ) +} ``` - + - -```jsx -import { Button } from '@primer/react' - -<> - - - - - +```jsx +import {Button} from '@primer/react' + +function Example() { + return ( + <> + + + + + + ) +} ``` - + diff --git a/.changeset/nervous-pets-sleep.md b/.changeset/nervous-pets-sleep.md index 5ce25e22c6b..3c8a546b471 100644 --- a/.changeset/nervous-pets-sleep.md +++ b/.changeset/nervous-pets-sleep.md @@ -4,9 +4,9 @@
-### ChoiceFieldset and ChoiceFieldset +### ChoiceFieldset -The `CheckboxGroup` and `RadioGroup` components are replacing the `ChoiceFieldset` component. The deprecation of `ChoiceFieldset` also allows us to deprecate `ChoiceInputField`. +The `CheckboxGroup` and `RadioGroup` components are replacing the `ChoiceFieldset` component. `CheckboxGroup` and `RadioGroup` have the ability to render contextual content with your fieldset: labels, validation statuses, captions. They also handle the ARIA attributes that make the form controls accessible to assistive technology. @@ -18,131 +18,96 @@ The `CheckboxGroup` and `RadioGroup` components are replacing the `ChoiceFieldse ```jsx -import {ChoiceFieldset} from "@primer/react" - -<> - // Multi-select - - - Preferred Primer component interface - - - - - Figma library - - - Primer CSS - - - Primer React components - - - Primer ViewComponents - - - - - // Single select - - - Preferred Primer component interface - - - - - Figma library - - - Primer CSS - - - Primer React components - - - Primer ViewComponents - - - - - +import {ChoiceFieldset} from '@primer/react' + +function Example() { + return ( + <> + {/* Multi-select */} + + Preferred Primer component interface + + Figma library + Primer CSS + Primer React components + Primer ViewComponents + + + + {/* Single select */} + + Preferred Primer component interface + + Figma library + Primer CSS + Primer React components + Primer ViewComponents + + + + ) +} ``` ```jsx -import {FormGroup, Checkbox} from "@primer/react" - -<> - // Multi-select - - - Preferred Primer component interface - - - - Figma - - - - CSS - - - - Primer React components - - - - Primer ViewComponents - - - - // Single select - - - Preferred Primer component interface - - - - Figma - - - - CSS - - - - Primer React components - - - - Primer ViewComponents - - - +import {CheckboxGroup, RadioGroup, FormControl Checkbox, Radio} from '@primer/react' + +function Example() { + return ( + <> + {/* Multi-select */} + + Preferred Primer component interface + + + Figma + + + + CSS + + + + Primer React components + + + + Primer ViewComponents + + + + {/* Single select */} + + Preferred Primer component interface + + + Figma + + + + CSS + + + + Primer React components + + + + Primer ViewComponents + + + + ) +} ``` - - - - - - - - -
Migration steps to CheckboxGroup and RadioGroup
- -Upgrade to the new `CheckboxGroup` and `RadioGroup` components by referring to the examples in our documentation: [CheckboxGroup](https://primer.style/react/CheckboxGroup), [RadioGroup](https://primer.style/react/RadioGroup). - -or - -Continue using the deprecated `ChoiceFieldset` component : +To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: ```js -import {ChoiceFieldset} from '@primer/react/deprecated' // change your import statements +import {ChoiceFieldset} from '@primer/react/deprecated' ``` -ChoiceFieldset codemod: https://github.com/primer/react-migrate/blob/main/src/use-deprecated-choicefieldset.js - -
+You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically. diff --git a/.changeset/olive-bears-act.md b/.changeset/olive-bears-act.md index 9a3198a0de7..d946f2f815f 100644 --- a/.changeset/olive-bears-act.md +++ b/.changeset/olive-bears-act.md @@ -16,51 +16,51 @@ The `FormControl` component is replacing the `FormGroup`, `InputField`, and `Cho ```jsx -import {FormControl, Checkbox, TextInput} from "@primer/react" - -<> - - Example text - - - - // OR - - - Example text - - - - // OR - - - Example text - - - - +import {FormControl, Checkbox, TextInput} from '@primer/react' + +function Example() { + return ( + <> + + Example text + + + {/* OR */} + + Example text + + + {/* OR */} + + Example text + + + + ) +} ``` ```jsx -import {FormGroup, TextInput} from "@primer/react" - -<> - - Example text - - - - // OR - - - Example text - - - - +import {FormGroup, TextInput} from '@primer/react' + +function Example() { + return ( + <> + + Example text + + + {/* OR */} + + Example text + + + + ) +} ``` @@ -69,49 +69,42 @@ import {FormGroup, TextInput} from "@primer/react" ```jsx -import {InputField} from '@primer/react' - - Example text - - +import {InputField, TextInput} from '@primer/react' + +function Example() { + return ( + + Example text + + + ) +} ``` ```jsx -import {FormControl} from '@primer/react' - - Example Text - - +import {FormControl, TextInput} from '@primer/react' + +function Example() { + return ( + + Example text + + + ) +} ``` - - - - - -
Migration steps to FormControl
- -Upgrade to the new `FormControl` component by referring to the [examples in our documentation](https://primer.style/react/FormControl). - -or - -Continue using the deprecated `FormGroup`, `ChoiceInputField` or `InputField` : +To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: ```js -import {FormGroup, ChoiceInputField, InputField} from '@primer/react/deprecated' // change your import statements +import {FormGroup, ChoiceInputField, InputField} from '@primer/react/deprecated' ``` -Codemods: - -- InputField codemod: https://github.com/primer/react-migrate/blob/main/src/use-deprecated-inputfield.js -- ChoiceInputField https://github.com/primer/react-migrate/blob/main/src/use-deprecated-choiceinputfield.js -- FormGroup codemod: https://github.com/primer/react-migrate/blob/main/src/use-deprecated-formgroup.js - -
+You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically.