Skip to content

Commit 580cdbb

Browse files
authored
Update Radio components to use controlled value prop instead of defaultValue in RadioGroup (#112)
1 parent cc748a0 commit 580cdbb

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

src/components/Forms/Controls/Radio/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type RadioGroupProps = Omit<
3232
| 'defaultValue'
3333
> & {
3434
name: string
35-
value: ChakraRadioGroup.ItemProps['value']
35+
value?: ChakraRadioGroup.ItemProps['value']
3636
horizontal?: boolean
3737
onChange?: (name: string, selectedValue: string) => void
3838
customGap?: string

src/components/Forms/Controls/Radio/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export type RadioGroupProps = Omit<
1919
| 'defaultValue'
2020
> & {
2121
name: string
22-
value: ChakraRadioGroup.ItemProps['value']
22+
value?: ChakraRadioGroup.ItemProps['value']
2323
horizontal?: boolean
2424
onChange?: (name: string, selectedValue: string) => void
2525
customGap?: string

src/components/Forms/Inputs/RadioList/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const RadioList = ({
5555
<div css={radioListContentListStyles}>
5656
<RadioGroup
5757
name={name}
58-
defaultValue={defaultValue}
58+
value={defaultValue}
5959
onChange={onCheckedChange}
6060
horizontal={horizontal && variant !== 'card'}
6161
>

src/components/Geospatial/Layers/LayerGroup/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const LayerGroup = ({
111111
<Accordion.ItemContent paddingLeft='16px' paddingRight='16px'>
112112
<RadioGroup
113113
name={label}
114-
defaultValue={defaultValue}
114+
value={defaultValue}
115115
customGap='0px'
116116
onChange={(name: string, selectedValue: string) =>
117117
handleOnChange(

src/components/Geospatial/Layers/LayerItem/LayerItemDemo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { LayerItem, RadioGroup } from '../../..'
33
const LayerItemDemo = () => (
44
<div>
55
<LayerItem label='Layer name 1' caption='caption' name='name' />
6-
<RadioGroup name='radio-group-2' defaultValue='5'>
6+
<RadioGroup name='radio-group-2' value='5'>
77
<LayerItem
88
label='Layer name 2'
99
caption='caption'

0 commit comments

Comments
 (0)