An official website of the United States government
Here’s how you know
Official websites use .gov A
.gov website belongs to an official government
organization in the United States.
Secure .gov websites use HTTPS A
lock (
) or https:// means you’ve safely connected to
the .gov website. Share sensitive information only on official,
secure websites.
The consistent placement, interface, and behavior of the language selection component allows users to easily find and access content in the language the user is most comfortable in.
Language selector pattern guidance
For more specific guidance about language selection design patterns, see the Select a language pattern family. This pattern family includes several language selection patterns that use this component:
When to use the language selector with three or more languages component
Content is available in three or more languages. Use this component if your site offers equivalent content in three or more languages.
When to consider something else
Incomplete content translations. If your site includes content in three or more languages but the majority of content is not available in each language.
Accessibility guidance
There should be enough color contrast between the button, the text inside the button, and the background to ensure readability.
Language links should contain a span element with the lang attribute. Every language link in the language selector dropdown that is different from content of the current page, should be defined using the lang attribute on a <span> tag wrapping the relevant text (e.g., <span lang="es">Hola</span> means Hello.). Please see H58: Using language attributes to identify changes in the human language.
Using the language selector with three or more languages component
The language button uses the .usa-button class and can be customized using the many available button variants.
For the in-header example, the language button uses the usa-button--small variant to match the size of the search button.
The language selector dropdown utilizes the accordion component which is also a dependency in the header component and is used by the navigation dropdowns in all example headers.
Customize the language button as needed for your implementation.
Package
Package usage:@forward "usa-language-selector";
Language selector unstyled
Use the unstyled version of the language button if your implementation calls for a link, or must be placed in a secondary navigation section with other links.
When to use the language selector unstyled component
Limited space. The unstyled version of the language button is good solution if you have limited space in your area of placement.
Secondary navigation. You may also use it in a secondary or maintenance navigation section as long as the navigation remains visible on desktop and mobile.
When to consider something else
Button groupings. Consider using a styled language button if your area of placement contains other buttons.
Accessibility guidance
There should be enough color contrast between the text of the link and the background to ensure readability.
Provide a visual element that shows when the text is a link. For example, permanently underline text or when hovering.
Language links should contain a span element with the lang attribute. Every language link in the language selector dropdown, that is different from content of the current page, should be defined using the lang attribute on a <span> tag wrapping the relevant text (e.g., <span lang="es">Hola</span> means Hello.). Please see H58: Using language attributes to identify changes in the human language.
Using the language selector unstyled component
The unstyled language button utilizes the unstyled button class and is easy to implement or customize further.
Package
Package usage:@forward "usa-language-selector";
Latest updates
Meaningful code and guidance updates are listed in the following table:
Date
USWDS version
Affects
Breaking
Description
2023-11-20
N/A
Guidance
No
Removed the note about using links styled as buttons in the two languages variant.
More information:
uswds-site#2162