Skip to content

Add multi-line text truncation utilities (line-clamp) - #42894

Open
Atibayounus wants to merge 3 commits into
twbs:mainfrom
Atibayounus:add-line-clamp-utility
Open

Atibayounus wants to merge 3 commits into
twbs:mainfrom
Atibayounus:add-line-clamp-utility

Conversation

@Atibayounus

@Atibayounus Atibayounus commented Sep 2, 2026

Copy link
Copy Markdown

Description

Adds a new .line-clamp-{n} utility class (for n = 1 to 5) that truncates multi-line text using -webkit-line-clamp, similar to how the existing .text-truncate utility handles single-line truncation.

Usage:

<p class="line-clamp-3">Long text that will be truncated after 3 lines...</p>

Motivation & Context

Multi-line text truncation is commonly needed in cards, product descriptions, article previews, and responsive layouts. Currently, developers need to write custom CSS for this behavior. This utility provides a consistent, reusable solution built into Bootstrap.

Type of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

  • N/A (docs not updated yet — this PR only adds the utility CSS/SCSS)

Related issues

Closes #42889

@Atibayounus
Atibayounus requested a review from a team as a code owner September 2, 2026 02:45
@github-project-automation github-project-automation Bot moved this to Needs review in v5.4.0 Sep 2, 2026
@julien-deramond julien-deramond moved this from Needs review to To analyze in v5.4.0 Sep 2, 2026
@Atibayounus

Copy link
Copy Markdown
Author

Hi maintainers, (@julien-deramond )just following up on this PR. The required workflow checks are currently waiting for approval to run, and the PR needs a review from someone with write access before it can be merged. Could someone please approve the pending workflows and take a look at this when you get a chance? Thanks!

@Speedykaya

This comment was marked as low quality.

willbyers1

This comment was marked as spam.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: To analyze

Development

Successfully merging this pull request may close these issues.

Add multi-line text truncation utilities

4 participants