/*
Form Label & Legend

Form Labels & Legends are used with form inputs to provide labels, hints, and errors that help the user enter information.

Markup: form-label.example.html

Style guide: components.form-label
*/

/*
`<FormLabel>`

The `FormLabel` component provides the `label` (or `legend`) for a field, along with any associated hint text and error message.

@react-component FormLabel

Style guide: components.form-label.react
*/

/*
---

### When to use

#### Labels

- Each form field should have a `<label>`. Never use a field's placeholder attribute as the primary way to label the field.

#### Legends

- Use a single legend for fieldset (this is required). One example of a common use of fieldset and legend is a question with radio button options for answers. The question text and radio buttons are wrapped in a fieldset, with the question itself being inside the legend tag.

### Usage

#### Labels

- Apply the `ds-c-label` class to `<label>` elements.
- Each field should have a `<label>`. Never use a field's `placeholder` attribute as the primary way to label the field.
- Labels should have a `for` attribute, referencing the corresponding input's unique `id` attribute. Only one label can be associated to each unique form element.
- Labels should be placed above their fields.
- Label text should be short and in sentence case.
- Avoid colons at the end of labels.

#### Hint text

- Place hint text within the field's `<label>` element.
- Apply the `ds-c-field__hint` class to hint text.
- Use hint text for supporting contextual help, which will always be shown.
- Hint text should sit above a form field and below the label text.

#### Validation

- Place inline validation messages within the field's `<label>` element.
- Visually align inline validation messages with the input fields, so people using screen magnifiers can read them quickly.

### Learn More

- [Form Guidelines](/guidelines/forms/)

Style guide: components.form-label.guidance
*/
