Use the label control if:
- You need a label for a control. We recommend that you always use labels for form controls.
Do not use the label control if:
- You want to insert a heading in the column header of a table.
- You want to use it as an alternative for the text control. Do not use the label control to display the data (for example, in display-only forms).
There are two types of label:
To indicate that a field is required, set the
required property to
true. An asterisk is then added automatically in front of the label.
- Always use a label for form controls.
- Use title case for labels.
- Do not use a placeholder (input prompt) instead of a label.
- Do not use bold labels.
The layout can sometimes be simplified by using a placeholder instead of the label control. This exception can be applied in the following cases:
- When the form pattern is easily understood, such as on a login screen. Since this screen consists of only two input controls (User Name and Password), the labels do not have to be used.
- When the form is extremely small and has fewer than three input fields. This can be the case for messages or small feedback forms.
- In search fields. For more information, see Search.