--- id: slds.guidance.utilities.line-clamp title: Line-clamp Utilities description: SLDS line-clamp utility classes for multi-line text truncation summary: "Utilities for multi-line text truncation (2-7 lines). Provides controlled text overflow with ellipsis for readable content length management." artifact_type: reference domain: utilities topic: line-clamp content_format: structured complexity: intermediate audience: [implementer] tasks: [implement] refs: - slds.guidance.utilities - slds.guidance.overview.utilities - slds.guidance.utilities.truncate tags: [utilities, line-clamp, truncation, text] keywords: [slds-line-clamp, text-truncation, ellipsis, multi-line] --- # Line Clamp - Multi-line Text Truncation Controlled multi-line text truncation with ellipsis. ## Line Limit Scale | Class | Lines | Use Case | |-------|-------|----------| | `slds-line-clamp` | 3 lines | Default truncation for card descriptions | | `slds-line-clamp_x-small` | 2 lines | Compact list items and previews | | `slds-line-clamp_small` | 3 lines | Standard card and tile descriptions | | `slds-line-clamp_medium` | 5 lines | Extended previews and summaries | | `slds-line-clamp_large` | 7 lines | Long-form content with controlled height | ## Common Patterns ### Card Description Truncation ```html

This is a long description that will be truncated after three lines of text. Any content beyond the third line will be hidden with an ellipsis to indicate more content is available.

``` ### Compact List Item Preview ```html ``` ### Extended Article Summary ```html

Article Title

This article summary can display up to five lines of content before truncation occurs. This provides enough context for readers to understand the main points while maintaining consistent layout height across multiple article cards in a grid or list view.
``` ### Long-form Content Preview ```html
Extended content preview that allows up to seven lines of text to be displayed. This is useful for detailed descriptions, documentation excerpts, or any scenario where more context is beneficial while still maintaining a maximum height constraint for consistent layouts across different content lengths.
``` ### Responsive Text Truncation ```html

Product Name

Brief product description limited to two lines

Product Details

More detailed product information that can extend up to five lines before being truncated

``` ## Best Practices ✅ Apply line-clamp classes directly to text elements (`

`, `

`, ``) ✅ Use `slds-line-clamp_x-small` (2 lines) for compact layouts and list items ✅ Use `slds-line-clamp` or `slds-line-clamp_small` (3 lines) for standard card descriptions ✅ Use `slds-line-clamp_medium` (5 lines) for extended previews ✅ Test truncation with actual content to ensure readability ✅ Provide "Show More" functionality when truncated content needs full access ❌ Do not apply to container elements with HTML children ❌ Never use on elements containing interactive components ❌ Do not rely on line-clamp for IE11 support (uses -webkit-line-clamp) ❌ Avoid using with single-line truncation (use [Truncate Utilities](ref:slds.guidance.utilities.truncate) instead)