-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2434 from department-of-veterans-affairs/megzehn-…
…formlabels Update form-labels.md
- Loading branch information
Showing
5 changed files
with
101 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
When a detailed form input label is not enough to convey the meaning or purpose of the input, we have three options for including additional context: | ||
|
||
1. [Beneath the label (default)](#default-hint-text) | ||
2. [Inline within the label](#inline-within-the-label) | ||
3. [Additional info](#additional-info) | ||
|
||
### Default hint text | ||
|
||
{% include storybook-preview.html story="uswds-va-text-input--with-hint-text" link_text="Label with hint text" %} | ||
|
||
This should be used in the case where the needed clarification is a little longer, but less than two sentences. These should ideally not wrap more than twice for a total of three lines. | ||
|
||
### Inline within the label | ||
|
||
{% include storybook-preview.html story="uswds-va-text-input--with-inline-hint-text" link_text="Label with inline hint text" %} | ||
|
||
This should be used in the case where the needed clarification is very short. | ||
|
||
### With Additional info | ||
|
||
{% include storybook-preview.html story="uswds-va-text-input--with-additional-info" link_text="Label with additional info hint text" %} | ||
|
||
Using the [additional info]({{ site.baseurl }}/components/additional-info) component should only be done in cases where the needed clarification is long, complex, requiring more than two sentences or multiple paragraphs, or special formatting (bullet points, links, etc.). | ||
|
||
We want to avoid this variation when possible. Use of this component for this purpose is a last resort when attempts at reducing the content have failed. If a field needs a lot of explanation, it should ideally be moved to a distinct page with explanation on the page itself. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% include storybook-preview.html story="uswds-va-text-input--error" link_text="Label with error" %} | ||
|
||
* In all cases, only show error validation messages or stylings after a user has interacted with a particular field. | ||
* The form field and its corresponding `<label>` are wrapped in a container which provides a thick border and padding to visual indicate an error message to users who might have difficulty perceiving contrast. It also changes the border of the input to red as a secondary indicator. | ||
* An error message is placed between the label and the form field. | ||
* The form field receives an `aria-describedby` attribute that references the `id` of the error message. | ||
* Prepending `<span class="sr-only">Error</span>` to error messages alerts screen screen readers clearly that an error exists. | ||
|
||
<a class="vads-c-action-link--blue" href="{{ site.baseurl }}/patterns/help-users-to/recover-from-errors">Review the help users to recover from errors pattern</a> |