You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: storybook/src/components/TextInput/TextInput.docs.mdx
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,22 +96,30 @@ We follow the advice against using `type="number"` by [NL Design System](https:/
96
96
97
97
### Size
98
98
99
-
The size of the input should be appropriate for the information to be entered.
100
-
Use the `size` attribute to set the right size.
99
+
Make the width of the input appropriate for the information to be entered.
100
+
Use the `size` attribute for this.
101
+
102
+
Avoid making it too narrow – ensure the user has enough space to operate comfortably.
103
+
This also gives browsers or extensions an opportunity to add an icon or button at the end.
104
+
105
+
We suggest a size of 15 for a phone number, 30 for an e-mail address, 40 for a web address, and 7 for a postal code.
101
106
102
107
<Canvasof={TextInputStories.Size} />
103
108
104
109
### Placeholder
105
110
106
-
This text appears in the field when it is empty. It can give a brief hint about the kind of data to enter.
111
+
We advise against placing a placeholder in an input field.
112
+
113
+
This text would only appear in the field when it is empty, which instead may make it appear filled in.
114
+
Even more so, the text disappears immediately after the user starts typing, which means they are no longer able to check whether their input matches the suggestions.
115
+
Thirdly, their usual grey colour is often difficult to read.
107
116
108
-
Don’t try too hard to find a suitable text for a placeholder.
109
-
Inputs without placeholder text are just fine – the label and a description should be clear enough.
110
-
Do not use a placeholder instead of a [Label](/docs/components-forms-label--docs).
117
+
Inputs without placeholder text are just fine.
118
+
Any text that you consider for a placeholder can be included in the description.
111
119
112
-
Follow the [guidelines for placeholder text](https://www.nldesignsystem.nl/richtlijnen/formulieren/placeholders) by NL Design System.
120
+
See also the [guidelines for placeholder text](https://www.nldesignsystem.nl/richtlijnen/formulieren/placeholders) by NL Design System, and [the advice to avoid them](https://design-system.service.gov.uk/components/text-input/#avoid-placeholder-text) by GOV UK.
113
121
114
-
<Canvasof={TextInputStories.Placeholder} />
122
+
In case third party applications does use placeholders, the component does apply the correct font and colour to them.
115
123
116
124
### Invalid
117
125
@@ -166,4 +174,4 @@ Check [the Field docs](/docs/components-forms-field--docs) for more information
166
174
## Further reading
167
175
168
176
- Extensive [guidelines for all types of input](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text) on Mozilla Developer Network.
169
-
-An overview of [suitable metadata for various kinds of content](https://nl-design-system.github.io/utrecht/storybook/?path=/docs/react_react-textbox--docs) to be entered by Gemeente Utrecht.
177
+
-At the same site, an overview of [autocompletion values](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete#token_list_tokens) which help enter personal details faster.
0 commit comments