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
An `<sp-field-label>` provides accessible labelling for form elements. Use the `for` attribute to outline the `id` of an element in the same DOM tree to which it should associate itself.
3
+
An `<sp-field-label>` provides accessible labelling for form elements. Use the `for` attribute to outline the `id` of an element in the same DOM tree to which it should associate itself. Field labels give context to information that a user needs to input and are commonly used in forms to provide users with clear guidance about what information is required.
Field labels can be positioned either on top of an input (default) or to the side of an input. The top position is recommended for most cases as it works better with long text, localization, and responsive layouts.
100
111
101
112
Using the `side-aligned` attribute will display the `<sp-field-label>` element inline with surrounding elements and the `start` and `end` values outline the alignment of the label text in the width specified.
102
113
103
-
### Start
114
+
<sp-tabsselected="top"autolabel="Label position options">
What you're hoping to learn from the seminar and any specific topics you'd
258
+
like covered
259
+
</sp-field-label>
260
+
<sp-textfield
261
+
placeholder="Enter your expectations"
262
+
id="seminar-field"
263
+
></sp-textfield>
264
+
```
265
+
266
+
### Accessibility
267
+
268
+
#### Always include a label
269
+
270
+
Every input should have a label. An input without a label is ambiguous and not accessible. In rare cases where context is sufficient and an accessibility expert has reviewed the design, the label could be visually hidden but should still include an `aria-label` in HTML.
271
+
272
+
#### Ensure proper association
273
+
274
+
The `for` attribute of the field label should match the `id` attribute of the associated input element to ensure proper association for screen readers and other assistive technologies.
275
+
276
+
#### Keep labels concise
277
+
278
+
Use a short, descriptive label (1-3 words) for the information that users need to provide. Supplementary information or requirements should be shown in help text below the field, not in the label.
279
+
280
+
#### Use sentence case
281
+
282
+
Following Adobe's UX writing style, field labels should be written in sentence case unless they contain words that are branded terms.
283
+
284
+
#### Don't add a colon at the end of a field label
285
+
286
+
The design of the component already communicates the relationship between the label and the input field, so a colon is unnecessary.
287
+
288
+
#### Mark only required or only optional fields, not both
289
+
290
+
In a single form, mark only the required fields or only the optional fields, depending on whichever is less frequent in the entire form. This reduces visual noise and makes the form easier to understand.
0 commit comments