Skip to content

Commit 71e9f13

Browse files
Add examples with captions
1 parent 4454d07 commit 71e9f13

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

stories/Form Elements/Checkboxes.stories.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,23 @@ export const Standard: Story = {
4343
),
4444
};
4545

46+
export const WithCaption: Story = {
47+
args: {
48+
legend: (
49+
<>
50+
<span className="nhsuk-caption-l">About you</span> What is your nationality?
51+
</>
52+
),
53+
},
54+
render: (args) => (
55+
<Checkboxes {...args}>
56+
<Checkboxes.Item value="british">British</Checkboxes.Item>
57+
<Checkboxes.Item value="irish">Irish</Checkboxes.Item>
58+
<Checkboxes.Item value="other">Citizen of another country</Checkboxes.Item>
59+
</Checkboxes>
60+
),
61+
};
62+
4663
export const WithHintText: Story = {
4764
args: {
4865
legend: 'How do you want to sign in?',

stories/Form Elements/Radios.stories.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,24 @@ export const InlineRadios: Story = {
4646
),
4747
};
4848

49+
export const RadiosWithCaption: Story = {
50+
args: {
51+
legend: (
52+
<>
53+
<span className="nhsuk-caption-l">About you</span> Have you changed your name?
54+
</>
55+
),
56+
},
57+
render: (args) => (
58+
<Radios {...args}>
59+
<Radios.Item value="yes">Yes</Radios.Item>
60+
<Radios.Item value="no" defaultChecked>
61+
No
62+
</Radios.Item>
63+
</Radios>
64+
),
65+
};
66+
4967
export const RadiosWithConditionalContent: Story = {
5068
args: {
5169
legend: 'Impairment requirement',

0 commit comments

Comments
 (0)