Identifier
An identifier is a banner in the footer of a web page that tells me who created it.
The Identifier component is a USWDS pattern used to communicate the administering agency of a website (or web page) and links required by federal laws and policies. It is a standard and recognizable design element of federal government sites. It can be used to establish trust across government sites if used consistently with the Footer component.
Details
- Extends: USWDS Identifier, no logos
The Identifier extends the USWDS Identifier, no logos.
Examples
domain.gov
This service was built by Code for America in partnership with Domain.gov on behalf of the people of the United States of America.
The HTML for the demonstration above is rendered using context passed to the component's Thymeleaf template fragment. Learn how to include component templates for Thymeleaf and Ruby in the source and usage section.
<div class="usa-identifier cfa-font-smooth">
<section class="usa-identifier__section usa-identifier__section--masthead" aria-label="Agency identifier">
<div class="usa-identifier__container">
<div class="usa-identifier__identity">
<p class="usa-identifier__identity-domain">domain.gov</p>
<p class="usa-identifier__identity-disclaimer">This service was built by Code for America in partnership with Domain.gov on behalf of the people of the United States of America.</p>
</div>
</div>
</section>
<nav class="usa-identifier__section usa-identifier__section--required-links" aria-label="Important links">
<div class="usa-identifier__container">
<ul class="add-list-reset">
<li class="usa-identifier__required-links-item">
<a class="usa-identifier__required-link usa-link usa-link--external usa-link--external" rel="noopener nofollow" target="_blank" href="https://codeforamerica.org">About Code for America</a>
</li>
<li class="usa-identifier__required-links-item">
<a class="usa-identifier__required-link usa-link usa-link--external usa-link--external" rel="noopener nofollow" target="_blank" href="https://codeforamerica.org/about-us/diversity-equity-inclusion">Diversity, Equity, & Inclusion</a>
</li>
</ul>
</div>
</nav>
<section class="usa-identifier__section usa-identifier__section--usagov" aria-label="Domain.gov government information and services">
<div class="usa-identifier__container">
<div class="usa-identifier__usagov-description">Looking for government information and services?</div>
<a class="usa-link usa-link--external" rel="noopener nofollow" target="_blank" href="https://get.gov">Visit domain.gov</a>
</div>
</section>
</div>
Context is the information necessary to configure and render a component template to HTML. It may include plain text strings, HTML, class names, IDs or other HTML attribute values. The context here is defined as JSON but the root attributes are translated to different variable syntaxes for Thymeleaf and Ruby templates. Learn how to pass these variables to each component template in the source and usage section.
{
"modifier": "cfa-font-smooth",
"identity": {
"ariaLabel": "Agency identifier",
"domain": "domain.gov",
"disclaimer": "This service was built by Code for America in partnership with Domain.gov on behalf of the people of the United States of America."
},
"requiredLinks": {
"ariaLabel": "Important links",
"items": [
{
"label": "About Code for America",
"href": "https://codeforamerica.org",
"target": "_blank",
"rel": "noopener nofollow",
"modifier": "usa-link--external"
},
{
"label": "Diversity, Equity, & Inclusion",
"href": "https://codeforamerica.org/about-us/diversity-equity-inclusion",
"target": "_blank",
"rel": "noopener nofollow",
"modifier": "usa-link--external"
}
]
},
"governmentSection": {
"ariaLabel": "Domain.gov government information and services",
"description": "Looking for government information and services?",
"link": {
"label": "Visit domain.gov",
"href": "https://get.gov",
"target": "_blank",
"rel": "noopener nofollow",
"modifier": "usa-link--external"
}
}
}
Guidance
Refer to additional guidance on the USWDS documentation site.
USWDS documentation siteAccessibility
Refer to additional accessibility guidance on the USWDS documentation site.
Checklist Key
Design library component
Source and usage
- Thymeleaf template fragment:
./cfa-identifier.th.html
- Embedded Ruby (ERB) partial template:
./_cfa-identifier.html.erb
Refer to the usage documentation for additional USWDS theme settings.
@use "uswds-core" with ( /* additional USWDS theme settings */ );
This is the pre-rendered template fragment from the package. It is the same template used to render the demonstrations above. You may copy and paste from this example or use the template using the th:block th:replace
tag. See the example below.
<div th:fragment="identifier(modifier, identity, requiredLinks, governmentSection)" class="usa-identifier" th:classappend="${modifier}">
<section th:if="${identity}" class="usa-identifier__section usa-identifier__section--masthead" th:attr="aria-label=${identity.ariaLabel}">
<div class="usa-identifier__container">
<div class="usa-identifier__identity">
<p th:if="${identity.domain}" class="usa-identifier__identity-domain" th:text="${identity.domain}">domain.gov</p>
<p th:if="${identity.disclaimer}" class="usa-identifier__identity-disclaimer" th:text="${identity.disclaimer}">Disclaimer</p>
</div>
</div>
</section>
<nav th:if="${requiredLinks}" class="usa-identifier__section usa-identifier__section--required-links" th:attr="aria-label=${requiredLinks.ariaLabel}">
<div class="usa-identifier__container">
<ul class="add-list-reset">
<li th:each="item: ${requiredLinks.items}" class="usa-identifier__required-links-item">
<a class="usa-identifier__required-link usa-link usa-link--external" th:href="${item.href}" th:classappend="${item.modifier}" th:attr="rel=${item.rel},target=${item.target}" th:text="${item.label}">Label</a>
</li>
</ul>
</div>
</nav>
<section th:if="${governmentSection}" class="usa-identifier__section usa-identifier__section--usagov" th:attr="aria-label=${governmentSection.ariaLabel}">
<div class="usa-identifier__container">
<div th:if="${governmentSection.description}" class="usa-identifier__usagov-description" th:text="${governmentSection.description}">Description</div>
<a th:if="${governmentSection.link}" class="usa-link" th:href="${governmentSection.link.href}" th:classappend="${governmentSection.link.modifier}" th:attr="rel=${governmentSection.link.rel},target=${governmentSection.link.target}" th:text="${governmentSection.link.label}">Visit domain.gov</a>
</div>
</section>
</div>
Below is an example of how to use the fragment from the package directory using the th:block th:replace
inclusion tag. Replace the fragment parameters using your variables or context.
<th:block th:replace="~{packages/cfa-identifier/cfa-identifier.th :: identifier(${modifier}, ${identity}, ${requiredLinks}, ${governmentSection})}" />
This is the pre-rendered partial template from the package. You may copy and paste from this example or use the template directly from the path.
<div class="usa-identifier<% if defined?(modifier) %> <%= modifier %><% end %>">
<% if defined?(identity) %><section class="usa-identifier__section usa-identifier__section--masthead"<% if identity['ariaLabel'] %> aria-label="<%= identity['ariaLabel'] %>"<% end %>>
<div class="usa-identifier__container">
<div class="usa-identifier__identity">
<% if identity['domain'] %><p class="usa-identifier__identity-domain"><%= identity['domain'] %></p><% end %>
<% if identity['disclaimer'] %><p class="usa-identifier__identity-disclaimer"><%= identity['disclaimer'] %></p><% end %>
</div>
</div>
</section><% end %>
<% if defined?(requiredLinks) %><nav class="usa-identifier__section usa-identifier__section--required-links"<% if requiredLinks['ariaLabel'] %> aria-label="<%= requiredLinks['ariaLabel'] %>"<% end %>>
<div class="usa-identifier__container">
<ul class="add-list-reset">
<% requiredLinks['items'].each do |item| %><li class="usa-identifier__required-links-item">
<a class="usa-identifier__required-link usa-link usa-link--external<% if item['modifier'] %> <%= item['modifier'] %><% end %>"
<% if item['href'] %>href="<%= item['href'] %>"<% end %>
<% if item['rel'] %>rel="<%= item['rel'] %>"<% end %>
<% if item['target'] %>target="<%= item['target'] %>"<% end %>><%= item['label'] %></a>
</li><% end %>
</ul>
</div>
</nav><% end %>
<% if defined?(governmentSection) %><section class="usa-identifier__section usa-identifier__section--usagov"<% if governmentSection['ariaLabel'] %> aria-label="<%= governmentSection['ariaLabel'] %>"<% end %>>
<div class="usa-identifier__container">
<% if governmentSection['description'] %><div class="usa-identifier__usagov-description"><%= governmentSection['description'] %></div><% end %>
<% if governmentSection['link'] %><a class="usa-link<% if governmentSection['link']['modifier'] %> <%= governmentSection['link']['modifier'] %><% end %>"
<% if governmentSection['link']['href'] %>href="<%= governmentSection['link']['href'] %>"<% end %>
<% if governmentSection['link']['rel'] %>rel="<%= governmentSection['link']['rel'] %>"<% end %>
<% if governmentSection['link']['target'] %>target="<%= governmentSection['link']['target'] %>"<% end %>><%= governmentSection['link']['label'] %></a><% end %>
</div>
</section><% end %>
</div>
Below is an example of how to include the partial in a view from the package directory using the Ruby ERB
class. Replace the argument values using your variables or context. In a Rails environment, the render
method can be used instead with the same hash values.
<%= ERB.new(File.read('packages/cfa-identifier/_cfa-identifier.html.erb'), 0, 0, '@identifier').result_with_hash({modifier: modifier, identity: identity, requiredLinks: requiredLinks, governmentSection: governmentSection}) %>