Use input prefixes and suffixes to show symbols or abbreviations that help users enter the right type of information in a form’s text input.
When to use the input prefix or suffix
Highlight the type of information. Prefixes and suffixes are useful when there’s a commonly understood symbol or abbreviation for the type of information the user needs to enter. Some common examples include units of measurement (like lbs or ft), symbols (like $ or %), or even icons (like showing an eye for password visibility).
Input cannot include units. Use prefixes and suffixes if the input refers to a unit or currency amount (like a length or dollar amount), but the user’s input must include digits only, not units or a currency symbol.
Reduce mental load. Adding a prefix or suffix can help the user more quickly understand what kind of information is requested.
When to consider something else
Open-ended form fields. If there aren’t specific parameters around the information the user needs to enter, a prefix or suffix may be incorrect. For example, don’t use a $ prefix for a form field asking “What’s a fair resolution?” if the user could enter either “$1,000” or “a full refund” as the answer.
Explanation requires additional words. Don’t use prefixes or suffixes if a symbol or abbreviation is insufficient to convey the meaning. There shouldn’t be any confusion between what type of information a prefix or suffix represents. This is especially true when using icons that could have multiple meanings.
Follow best practices when using an icon. If you include an icon as a prefix or suffix, follow the design system’s icon guidance.
Use common abbreviations. Only use commonly understood abbreviations when indicating a text prefix or suffix. Don’t use the full word.
Hide from screen readers. Prefixes and suffixes are hidden from screen readers using
Use descriptive labels. Labels should clearly indicate what type of data to enter since prefixes and suffixes are hidden from screen readers. For example, if you’re requesting someone’s height in inches, you have “in.” appear in a suffix, but your form label should say “Height, in inches.”
Using the input prefix or suffix
Placement. Place the
.usa-input. Both elements are placed inside
Use text or icons. Input prefixes and suffixes can accept either plain text or icons.
Validation. Place input validation classes on
Input prefix or suffix settings
This component has no settings.
Input prefix or suffix variants
Displays an input group error state
Displays an input group at a specific width. Accepts