Form label
About
What does it do?
- Tells users what a field is for.
When to use it?
- When you are requesting multiple pieces of information to answer the same question. For example, the day, month and year of a date.
- The label must appear directly above the field.
When not to use it?
- Do not use this component to ask more questions within a question - instead, ask a new question.
- When you're giving extra information and hints to help the user answer a question.
HTML markup
<label class="wmnds-fe-label" for="genericInput">Form label</label>
Nunjucks markup
{% from "wmnds/components/form-elements/form-label/_form-label.njk" import wmndsFormLabel %}
{{
wmndsFormLabel({
contentText: "Form label",
contentHTML: null,
for: "genericInput",
classes: null
})
}}
Nunjucks properties
Name | Type | Description |
---|---|---|
contentText | string | Required. Text to use within the label. If contentHTML is provided this is not required and will be ignored. |
contentHTML | string | Required. HTML to use within the label. If contentText is provided, this is not required. |
for | string | Required. The value of the for attribute, the id of the input the label is associated with. |
classes | string | Classes to add to the label tag. |