Skip to content

Commit f6dbf14

Browse files
Update text input examples
1 parent c13bb75 commit f6dbf14

File tree

1 file changed

+65
-7
lines changed

1 file changed

+65
-7
lines changed

stories/Form Elements/TextInput.stories.tsx

Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const meta: Meta<typeof TextInput> = {
77
component: TextInput,
88
args: {
99
id: 'input-example',
10-
name: 'test-name',
11-
label: 'National Insurance number',
10+
name: 'example',
11+
label: 'What is your full name?',
1212
labelProps: { isPageHeading: true, size: 'l' },
1313
},
1414
argTypes: {
@@ -22,30 +22,88 @@ type Story = StoryObj<typeof TextInput>;
2222
export const Standard: Story = {};
2323
export const WithHintText: Story = {
2424
args: {
25-
hint: 'It’s on your National Insurance card, benefit letter, payslip or P60. For example, ‘QQ 12 34 56 C’.',
25+
label: 'What is your NHS number?',
26+
inputMode: 'numeric',
27+
spellCheck: false,
28+
hint: (
29+
<>
30+
This is a 10 digit number (like <span className="nhsuk-u-nowrap">999 123 4567</span>) that
31+
you can find on an NHS letter, prescription or in the NHS App
32+
</>
33+
),
2634
},
2735
};
2836

2937
export const WithError: Story = {
3038
args: {
31-
error: 'Error message goes here',
32-
hint: 'It’s on your National Insurance card, benefit letter, payslip or P60. For example, ‘QQ 12 34 56 C’.',
39+
label: 'What is your NHS number?',
40+
error: 'Enter NHS number',
41+
inputMode: 'numeric',
42+
spellCheck: false,
43+
},
44+
};
45+
46+
export const WithErrorAndHintText: Story = {
47+
args: {
48+
label: 'What is your NHS number?',
49+
error: 'Enter NHS number',
50+
inputMode: 'numeric',
51+
spellCheck: false,
52+
hint: (
53+
<>
54+
This is a 10 digit number (like <span className="nhsuk-u-nowrap">999 123 4567</span>) that
55+
you can find on an NHS letter, prescription or in the NHS App
56+
</>
57+
),
3358
},
34-
name: 'With Error (String)',
3559
};
3660

3761
export const WithWidthModifier: Story = {
3862
args: {
63+
label: 'What is your NHS number?',
3964
width: 10,
40-
hint: 'It’s on your National Insurance card, benefit letter, payslip or P60. For example, ‘QQ 12 34 56 C’.',
65+
inputMode: 'numeric',
66+
spellCheck: false,
67+
hint: (
68+
<>
69+
This is a 10 digit number (like <span className="nhsuk-u-nowrap">999 123 4567</span>) that
70+
you can find on an NHS letter, prescription or in the NHS App
71+
</>
72+
),
73+
},
74+
};
75+
76+
export const WithPrefix: Story = {
77+
args: {
78+
label: 'Cost in pounds',
79+
prefix: '£',
80+
width: 5,
81+
},
82+
};
83+
84+
export const WithSuffix: Story = {
85+
args: {
86+
label: 'Weight in kilograms',
87+
suffix: 'kg',
88+
width: 5,
4189
},
4290
};
4391

4492
export const WithPrefixAndSuffix: Story = {
4593
args: {
94+
label: 'Cost per item, in pounds',
95+
prefix: '£',
96+
suffix: 'per item',
4697
width: 5,
98+
},
99+
};
100+
101+
export const WithPrefixAndSuffixAndError: Story = {
102+
args: {
47103
label: 'Cost per item, in pounds',
104+
error: 'Enter a cost per item, in pounds',
48105
prefix: '£',
49106
suffix: 'per item',
107+
width: 5,
50108
},
51109
};

0 commit comments

Comments
 (0)