uswds_base-8.x-2.0-alpha1/templates/form/details.html.twig
templates/form/details.html.twig
{#
/**
* @file
* Default theme implementation for a details element.
*
* Available variables
* - attributes: A list of HTML attributes for the details element.
* - errors: (optional) Any errors for this details element, may not be set.
* - title: (optional) The title of the element, may not be set.
* - description: (optional) The description of the element, may not be set.
* - children: (optional) The children of the element, may not be set.
* - value: (optional) The value of the element, may not be set.
*
* @see template_preprocess_details()
*
* @ingroup themeable
*/
#}
<ul class="usa-accordion-bordered usa-unstyled-list">
{%
set summary_classes = [
required ? 'js-form-required',
required ? 'form-required',
]
%}
<li>
{%- if uncollapsible and title -%}
<h4 class="uswds-uncollapsible-title">{{ title }}</h4>
{% elseif title %}
<button type="button" aria-controls="{{ attributes.id }}-content"{{ summary_attributes.addClass(summary_classes) }}>{{ title }}</button>
{%- endif -%}
{% if errors %}
<div>
{{ errors }}
</div>
{% endif %}
<div id="{{ attributes.id }}-content" class="usa-accordion-content">
{{ description }}
{{ children }}
{{ value }}
</div>
</li>
</ul><!-- USWDS fieldset end -->
