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
{{ message }}
This repository is currently being migrated. It's locked while the migration is in progress.
Copy file name to clipboardExpand all lines: src/_components/details.md
+32-33Lines changed: 32 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
layout: component
3
3
title: Details
4
4
status: use-with-caution-candidate
5
-
intro-text: "Details makes content easier to scan as it hides information that may not be applicable to all users or situations. We use the Details component to situate plain language help at the point of the process where it is most relevant."
5
+
intro-text: "The Details component reveals optional, supporting information that isn't required for most users to complete a task. It is used to provide plain language help at the point where it is most relevant."
{% include storybook-preview.html story="components-va-details--default" link_text="va-details default" %}
26
+
{% include storybook-preview.html story="components-va-details--default" link_text="va-details default" %}
28
27
29
28
### Different widths
30
-
Use the Details component with a reduced width when you need the Details component to have less visual space on the page.
29
+
Use a reduced width when you need Details to take up less space on the page.
31
30
32
-
{% include storybook-preview.html story="components-va-details--widths" link_text="va-details widths" %}
31
+
{% include storybook-preview.html story="components-va-details--widths" link_text="va-details widths" %}
33
32
34
33
## Usage
35
34
36
35
### When to use Details
37
36
38
-
***Revealing helpful background information**: When you have additional information you want to convey about an application, process, or a step or question in a form that is not critical. This component should be used in instances where a more prominent [Alert]({{ site.baseurl }}/components/alert) would not be appropriate.
39
-
***Clarifying outcomes for an input**: In cases where a person's input can have large or complicated impact on outcomes we use contextual help in Details to locate expanded guidance next to the relevant interaction.
40
-
***Information closely tied to an input.** Use this component over an [Accordion]({{ site.baseurl }}/components/accordion) when the content is closely tied to a particular message or input on the screen. If the content is more tangentially related then use an Accordion.
41
-
***Clarifying a form question**: If a form question needs clarification, and that clarification is brief, use Details. The lighter design prevents breaking up the visual progression as the user navigates the form. These can also serve as alternative to where accordions feel too heavy. Be sure to review the [hint text guidance]({{ site.baseurl }}/components/form/label#hint-text) for implementation details. If a form is a conversation, Details would be considered an aside. (This <ahref="https://blog.navapbc.com/structuring-a-complex-eligibility-form-for-healthcare-gov-37d79a5ad6">case study on structuring complex health care questions for healthcare.gov</a> goes into greater detail on how to structure your form as a conversation.)
37
+
***Revealing helpful background information.** Use this component when you have additional information about an application, process, or form step that isn't critical. Use this component in instances where a more prominent [Alert]({{ site.baseurl }}/components/alert) wouldn't be appropriate.
38
+
***Explaining the impact of a choice.** If a user's answer will significantly affect their results or next steps, use Details to put that explanation right next to the relevant field.
39
+
***Information closely tied to an input.** Use this component over an [Accordion]({{ site.baseurl }}/components/accordion) when the content is closely tied to a particular message or input on the screen. If the content is only loosely related, use an Accordion instead.
40
+
***Clarifying a form question.** If a form question needs clarification, and that clarification is brief, use Details. The lighter design doesn't interrupt the flow of the form. These can also serve as an alternative when accordions feel too heavy or when hint text isn't enough. Be sure to review the [hint text guidance]({{ site.baseurl }}/components/form/label#hint-text) for more information.
42
41
***Content that can be organized under the current heading.** If you have additional content that provides context and makes sense under the same heading as the content nearby.
43
-
***Information not applicable to all**: Details can hide details that may not be applicable to all users.
42
+
***Information not applicable to all.** The Details component can hide information that doesn't apply to all users.
44
43
45
44
### When to consider something else
46
45
47
-
***Accordions for a series**: If you have a series of content in the body of a page and outside of a form or tool then an [Accordion]({{ site.baseurl }}/components/accordion) is preferred. For example, if you have a series of questions as part of an FAQ section or a set of options for payment that each have additional details.
48
-
***Too much content**: Only include critical information inside this component. This includes form fields that require a lot of explanation. Link to another page, consider an [Accordion]({{ site.baseurl }}/components/accordion), or shorten the content. Collaborate with a member of the Content and IA team to edit content and explore alternatives.
49
-
***Required content**: If the majority of people need the content to accomplish the main task then it should not be hidden from view.
50
-
***Content organized under a new heading.** If you have enough content that it makes sense to organize under a new heading that does not make sense under the same heading as the content nearby then use an [Accordion]({{ site.baseurl }}/components/accordion).
51
-
***Error messages or other immediate actions**: Do not use this component for error messages or other critical or timely information.
52
-
***Inside Alerts**: Use this component inside an [Alert]({{ site.baseurl }}/components/alert) only as a last resort and if approved in the Collaboration Cycle. Instead use the [Alert - Expandable]({{ site.baseurl }}/components/alert/alert-expandable) component, especially when the Alert is within the page content and not at the top of the page.
53
-
***Floating in space**: Try to avoid using Details outside of the flow of the page, unattached to a section of content or another component. For example, there are instances of Details between a h1 and a Card. See [placement](#placement) for more.
46
+
***Accordions for a series.** If you have a series of content in the body of a page and outside of a form or tool, use an [Accordion]({{ site.baseurl }}/components/accordion) instead. For example, a series of FAQ questions or a set of payment options that each have additional information.
47
+
***Too much content.** Only include critical information inside this component. This includes form fields that require a lot of explanation. Link to another page, consider an [Accordion]({{ site.baseurl }}/components/accordion), or shorten the content. Collaborate with a member of the Content and Information Architecture (IA) team to edit content and explore alternatives.
48
+
***Required content.** If most people need the content to accomplish the main task, don't hide it from view.
49
+
***Content organized under a new heading.** If the content warrants a new heading that doesn't belong under the same heading as nearby content, use an [Accordion]({{ site.baseurl }}/components/accordion) instead.
50
+
***Error messages or other immediate actions.** Don't use this component for error messages or other critical or timely information.
51
+
***Inside Alerts.** Use this component inside an [Alert]({{ site.baseurl }}/components/alert) only as a last resort and if approved in the Collaboration Cycle. Instead use the [Alert - Expandable]({{ site.baseurl }}/components/alert/alert-expandable) component, especially when the Alert is within the page content and not at the top of the page.
52
+
***Floating in space.** Try to avoid using Details outside of the flow of the page, unattached to a section of content or another component. See [placement](#placement)guidance on this page for more information.
54
53
55
54
{% include content/details-vs-hint-text-vs-accordion.md %}
56
55
57
-
##Behavior
56
+
### How this component works
58
57
59
58
The Details component uses native HTML `<details>` and `<summary>` elements, which provide several advantages over JavaScript-based implementations:
60
59
61
-
***Searchable and discoverable content**: Browser search (Ctrl+F or Cmd+F) can find text inside collapsed Details, and search engines can index the content for better search engine optimization (SEO).
62
-
***Better performance and reliability**: No JavaScript required for basic functionality, improving load times and ensuring content works even when JavaScript fails.
63
-
***Enhanced accessibility**: Native semantic meaning provides better assistive technology support without additional ARIA attributes, following web standards universally supported across browsers.
60
+
***Searchable and discoverable content.** Browser search (Ctrl+F or Cmd+F) can find text inside collapsed Details, and search engines can index the content for better search engine optimization (SEO).
61
+
***Better performance and reliability.** This component requires no JavaScript for basic functionality, improving load times and ensuring content works even when JavaScript fails.
62
+
***Enhanced accessibility.** Native semantic meaning provides better assistive technology support without additional ARIA attributes, following web standards universally supported across browsers.
64
63
65
64
### Placement
66
65
67
-
The following are places where Details can be used:
66
+
You can use Details in these places:
68
67
69
-
* After a header (h2, h3, h4) or paragraph to provide orthogonal details or provide an answer to a common question.
70
-
* Within a [Process list]({{ site.baseurl }}/components/process-list) to shorten the length of content within a step.
71
-
* Within, or at the end, of a [Form]({{ site.baseurl }}/components/form/label#with-details) to provide additional help text.
72
-
*Whenever there is a chance to enhance the understanding a user has about a particular choice.
68
+
* After a header (h2, h3, or h4) or paragraph to provide supplementary information or answer a common question
69
+
* Within a [Process list]({{ site.baseurl }}/components/process-list) to shorten the length of content within a step
70
+
* Within, or at the end, of a [Form]({{ site.baseurl }}/components/form/label#with-details) to provide additional help text
71
+
*When you need to help users understand a particular choice
73
72
74
-
**Note:** Placement does not alter [content considerations](#content-considerations)in any way.
73
+
**Note:** Placement of Details doesn't change the [content considerations](#content-considerations)for this component.
75
74
76
75
{% include component-docs.html component_name=page.web-component %}
77
76
78
77
## Content considerations
79
78
80
-
***Use a statement, rather than a question.** Use a statement (like "Why we ask for this information") rather than a question (like "Why does VA ask for this information?") for the title (trigger text) of the component. Because we use questions to gather information from people in our forms, structuring additional information as questions as well can cause confusion. Keep titles to a single sentence or sentence fragment with no ending punctuation.
81
-
***Limit the amount of expanded content.** Limit content to fewer than 500 characters (with spaces) when possible. If you need to provide more information, consider using one or more [Accordions]({{ site.baseurl }}/components/accordion) instead or providing a brief overview in the Details component with a link to another page with more information. Collaborate with a member of the Content and Information Architecture team to edit content and explore alternatives.
82
-
***Use lists in expanded content as needed.**To make content easier to scan, we encourage you to use numbered (also called "ordered") and bulleted (also called "unordered") lists as needed.
79
+
***Use a statement, rather than a question.** Use a statement (like "Why we ask for this information") rather than a question (like "Why does VA ask for this information?") for the label of the component. Framing help text as questions can confuse people who expect questions to ask for their input. Keep titles to a single sentence or sentence fragment with no ending punctuation.
80
+
***Limit the amount of expanded content.** Limit content to fewer than 500 characters (with spaces) when possible. If you need to provide more information, use 1 or more [Accordions]({{ site.baseurl }}/components/accordion) instead. You can also include a brief overview in Details with a link to a page that has more detail. Collaborate with a member of the Content and Information Architecture team to edit content and explore alternatives.
81
+
***Use lists in expanded content as needed.**Use numbered (ordered) and bulleted (unordered) lists to make content easier to scan.
83
82
84
83
## Accessibility considerations
85
84
86
-
***Wrap content in HTML elements.**All text content inside `va-details`must be wrapped in an appropriate HTML element such as `<p>`, `<span>`, or `<div>`. Some screen readers, particularly NVDA, may ignore unwrapped plain text. For example, use `<p>This is the content.</p>` instead of placing text directly inside the component without a wrapper element.
87
-
***Do not add ARIA roles or state attributes.** The details component uses the `<details>` HTML element that exposes expanded/collapsed state and interactive behavior natively. Adding any `role="button"` or `aria-expanded` is redundant and can create conflicting announcements in assistive technology.
88
-
***Keyboard interaction is provided natively.** Users must be able to tab to the component, toggle it using Enter or Space, and if there are interactive elements in the component, the next tab takes them to those interactive elements.
85
+
***Wrap content in HTML elements.**Place all text content inside `va-details`within an appropriate HTML element such as `<p>`, `<span>`, or `<div>`. Some screen readers, particularly NVDA, may ignore unwrapped plain text. For example, use `<p>This is the content.</p>` instead of placing text directly inside the component without a wrapper element.
86
+
***Don't add ARIA roles or state attributes.** The Details component uses the `<details>` HTML element that exposes expanded/collapsed state and interactive behavior natively. Adding any `role="button"` or `aria-expanded` is redundant and can create conflicting announcements in assistive technology.
87
+
***Native keyboard interaction.** Users can tab to the component and toggle it open or closed with Enter or Space. If the component contains interactive elements, the next Tab keypress moves focus to those elements.
Copy file name to clipboardExpand all lines: src/_includes/content/details-vs-hint-text-vs-accordion.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,11 @@
2
2
3
3
When deciding which component to use inside a form, consider how essential the information is and how it relates to nearby content:
4
4
5
-
***Essential information for form fields:** Use {% if page.url == '/components/form/label' %}hint text{% else %}[hint text]({{ site.baseurl }}/components/form/label#hint-text){% endif %} for brief, critical information that most users need to complete a field successfully.
6
-
***Helpful context tied to specific content:** Use {% if page.url == '/components/details' %}Details{% else %}[Details]({{ site.baseurl }}/components/details){% endif %} for brief explanations related to nearby form fields or sections that users can access when needed.
7
-
***Substantial standalone information:** Use {% if page.url == '/components/accordion' %}Accordion{% else %}[Accordion]({{ site.baseurl }}/components/accordion){% endif %} for lengthy content that deserves its own heading or multiple related topics like FAQ sections.
5
+
***Essential information for form fields.** Use {% if page.url == '/components/form/label' %}hint text{% else %}[hint text]({{ site.baseurl }}/components/form/label#hint-text){% endif %} for brief, critical information that most users need to complete a field successfully.
6
+
***Helpful context tied to specific content.** Use {% if page.url == '/components/details' %}Details{% else %}[Details]({{ site.baseurl }}/components/details){% endif %} for brief explanations related to nearby form fields or sections that users can access when needed.
7
+
***Substantial standalone information.** Use {% if page.url == '/components/accordion' %}Accordion{% else %}[Accordion]({{ site.baseurl }}/components/accordion){% endif %} for lengthy content that deserves its own heading or multiple related topics like FAQ sections.
8
8
9
-
### Decision tree
9
+
####Decision tree
10
10
11
11
<divclass="mermaid-width mermaid-comparison">
12
12
<divclass="sr-only">
@@ -43,25 +43,27 @@ flowchart TD
43
43
44
44
<h4>Text-based decision guide</h4>
45
45
46
-
<ol>
46
+
<olstyle="font-size:1rem;">
47
+
<!-- fontsize defined because the details component is resizing this text to 16.96px -->
48
+
47
49
<li><strong>Is this information essential for completing a form field?</strong>
48
50
<ul>
49
-
<li><strong>Yes</strong> (Field requirements, input patterns) → <em>Use hint text</em></li>
51
+
<li><strong>Yes</strong> (Field requirements, input patterns) → Use hint text</li>
50
52
<li><strong>No</strong> (Background context, helpful clarifications) → Continue to question 2</li>
51
53
</ul>
52
54
</li>
53
55
54
56
<li><strong>Is content related to a nearby form field or section?</strong>
55
57
<ul>
56
58
<li><strong>Yes</strong> (Why we ask questions, field-specific help) → Continue to question 3</li>
0 commit comments