Skip to content

Commit 4be2977

Browse files
Use defaultValue and defaultChecked without change handlers
1 parent 71ee965 commit 4be2977

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

stories/Form Elements/Radios.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const StandardRadios: Story = {
1919
id="standard-example"
2020
>
2121
<Radios.Item value="yes">Yes</Radios.Item>
22-
<Radios.Item value="no" checked>
22+
<Radios.Item value="no" defaultChecked>
2323
No
2424
</Radios.Item>
2525
</Radios>
@@ -37,7 +37,7 @@ export const InlineRadios: Story = {
3737
inline
3838
>
3939
<Radios.Item value="yes">Yes</Radios.Item>
40-
<Radios.Item value="no" checked>
40+
<Radios.Item value="no" defaultChecked>
4141
No
4242
</Radios.Item>
4343
</Radios>
@@ -168,7 +168,7 @@ export const RadiosWithError: Story = {
168168
<Radios.Item id="example-1" value="yes">
169169
Yes
170170
</Radios.Item>
171-
<Radios.Item id="example-2" value="no" checked>
171+
<Radios.Item id="example-2" value="no" defaultChecked>
172172
No
173173
</Radios.Item>
174174
</Radios>

stories/Form Elements/Select.stories.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ type Story = StoryObj<typeof Select>;
1111

1212
export const Standard: Story = {
1313
render: (args) => (
14-
<Select label="Label text goes here" labelProps={{ size: 'l' }}>
14+
<Select label="Label text goes here" labelProps={{ size: 'l' }} defaultValue="2">
1515
<Select.Option value="1">NHS.UK frontend option 1</Select.Option>
16-
<Select.Option value="2" selected>
17-
NHS.UK frontend option 2
18-
</Select.Option>
16+
<Select.Option value="2">NHS.UK frontend option 2</Select.Option>
1917
<Select.Option value="3" disabled>
2018
NHS.UK frontend option 3
2119
</Select.Option>

0 commit comments

Comments
 (0)