Wrapping and Truncation
Foundations / Interaction / Wrapping and Truncation
Intro
Wrapping and truncation define how text behaves when the length of the text exceeds the available space. The responsive behavior is device-independent and is the same on all form factors. Different controls use wrapping to show full text or truncation to save space, depending on how important the information is and how much room is available.
When to Use
Always check the responsive behavior of text, even if the text appears to fit at first glance. Issues often arise when text is translated into another language, or when the text container is resized. Choose the most appropriate text display variant for your use case.
In general, wrapping is the default way to design the responsive behavior of text. Always consider using wrapping unless there are specific requirements otherwise.
Use wrapping if:
- The information is crucial for the user.
- The user is required to read the full text (for example, in consent forms).
- You are uncertain about how important the text is for the user.
- You want to display numbers in a piece of continuous text.
- The text for a list item is crucial for the user.
- You are displaying a label, object status, link, or title. For these components, use a short, precise text.
Use truncation if:
- The component is designed to save vertical space and only allows one line of text with a limited width (for example, the title of a toolbar).
- The text contains only secondary information. For example, the text in a table cell could use truncation if the corresponding column is resizable or uses a custom display concept to provide an additional interaction.
Use a combination of wrapping and truncation if:
- The text is a teaser or serves as an appetizer for a longer text, such as an article. In this case, you can define the maximum number of lines shown.
- The component is designed to save vertical space, and only allows a limited number of lines, with a limited width (for example, tiles with two lines for the title).
Don’t use wrapping, truncation, or a combination of both if:
- You want to show a standalone numeric value, such as 1,000.00 EUR.
- The text is inside another UI element that is not intended to wrap (such as a button).
Variants
Wrapping and truncation variants – wrapping, truncation, and combined behavior in different components.
A. Wrapping: Automatically moves text to the next line when it no longer fits within the available space. When a word doesn’t fit at the end of a line, either the whole word moves to the next line, or only part of it, depending on the language. The example shows wrapped text in a message strip.
B. Truncation: Shortens text by cutting it off when it exceeds the available space. Excess text is hidden. A truncation indicator (ellipsis: … ) usually appears at the end of the truncated text depending on browser support. The example shows truncated text in a dialog header.
C. Combination of Wrapping and Truncation: A text may first wrap over multiple lines and then truncate when the line limit is reached. The example shows a card title that wraps over three lines and then truncates.
Displaying Truncated Text
It is important to provide users with a quick way to see the full text with a single interaction. This can be achieved with the existing interactions for a component, via navigation to a detailed view, or by implementing a custom display concept.
Built-In Display Mechanism
The component already has an interaction mechanism that reveals the full text.
Truncation in a dropdown list – remaning text is revealed when the list is opened
Display via Detail View
The full text becomes visible once the user navigates to the detail view in the user flow. Typically, the user navigates to a different screen or opens a popover or dialog.
Truncation in a card – remaining text is revealed when navigating to the detail view
Custom Display Concept: Expandable Text
If the component has no built-in mechanism or navigation option to display the full text, implement a custom solution using expandable text.
Expandable text allows the user to display the full text with a single interaction on an additional element, such as a link. The text can be expanded in place or be displayed in a separate popover.
Example 1: Expanded text in place
Clicking the Show More link expands the text while clicking the Show Less link collapses it
Example 2: Full text in a popover
Clicking the link Show More link opens a popover with the full text while clicking the Show Less link hides it
Ensure that users can interact with the truncated text on interactive components, not only using a mouse, but also with a keyboard or touchscreen.[internal_only] For examples, see the specification.[/internal_only]
The order of tabs on a tab bar must always remain consistent. The tab order should not be affected by truncation or by a custom solution to display the full tab text.
Usage Overview
[internal_only]
Related Links
Specifications
[/internal_only]