A plugin that provides utilities for visually truncating text after a fixed number of lines.
Installations
npm install @tailwindcss/line-clamp
Developer
tailwindlabs
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
16.18.1
NPM Version
8.19.2
Statistics
1,179 Stars
63 Commits
36 Forks
13 Watching
1 Branches
14 Contributors
Updated on 26 Nov 2024
Bundle Size
618.00 B
Minified
371.00 B
Minified + Gzipped
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
65,118,725
Last day
-2.8%
82,498
Compared to previous day
Last week
0.2%
435,891
Compared to previous week
Last month
8.2%
1,848,382
Compared to previous month
Last year
-13.7%
22,001,134
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
1
Dev Dependencies
4
@tailwindcss/line-clamp
A plugin that provides utilities for visually truncating text after a fixed number of lines.
Warning As of Tailwind CSS v3.3 the
line-clamp
utilities are now included in the framework by default and this plugin is no longer required.
Installation
Install the plugin from npm:
1npm install -D @tailwindcss/line-clamp
Then add the plugin to your tailwind.config.js
file:
1// tailwind.config.js 2module.exports = { 3 theme: { 4 // ... 5 }, 6 plugins: [ 7 require('@tailwindcss/line-clamp'), 8 // ... 9 ], 10}
Usage
Use the line-clamp-{n}
utilities to specify how many lines of text should be visible before truncating:
1<p class="line-clamp-3"> 2 Et molestiae hic earum repellat aliquid est doloribus delectus. Enim illum odio porro ut omnis dolor debitis natus. Voluptas possimus deserunt sit delectus est saepe nihil. Qui voluptate possimus et quia. Eligendi voluptas voluptas dolor cum. Rerum est quos quos id ut molestiae fugit. 3</p>
To remove any line-clamping, use line-clamp-none
:
1<p class="line-clamp-3 md:line-clamp-none"> 2 Et molestiae hic earum repellat aliquid est doloribus delectus. Enim illum odio porro ut omnis dolor debitis natus. Voluptas possimus deserunt sit delectus est saepe nihil. Qui voluptate possimus et quia. Eligendi voluptas voluptas dolor cum. Rerum est quos quos id ut molestiae fugit. 3</p>
Note that the
line-clamp-{n}
set other properties likedisplay
andoverflow
in addition to-webkit-line-clamp
which are not unset byline-clamp-none
, so depending on what you are trying to achieve you may need to explicitly override those properties with utilities likeflex
oroverflow-visible
as well.
Utilities are for clamping text up to 6 lines are generated by default:
Class | CSS |
---|---|
line-clamp-1 | overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; |
line-clamp-2 | overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; |
line-clamp-3 | overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; |
line-clamp-4 | overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; |
line-clamp-5 | overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; |
line-clamp-6 | overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; |
line-clamp-none | -webkit-line-clamp: unset; |
Configuration
You can configure which values and variants are generated by this plugin under the lineClamp
key in your tailwind.config.js
file:
1// tailwind.config.js 2module.exports = { 3 theme: { 4 extend: { 5 lineClamp: { 6 7: '7', 7 8: '8', 8 9: '9', 9 10: '10', 10 } 11 } 12 }, 13 variants: { 14 lineClamp: ['responsive', 'hover'] 15 } 16}
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
packaging workflow detected
Details
- Info: Project packages its releases by way of GitHub Actions.: .github/workflows/release-insiders.yml:12
Reason
Found 4/30 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1
- Info: topLevel 'contents' permission set to 'read': .github/workflows/release-insiders.yml:8
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/tailwindlabs/tailwindcss-line-clamp/nodejs.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/tailwindlabs/tailwindcss-line-clamp/nodejs.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/tailwindlabs/tailwindcss-line-clamp/nodejs.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-insiders.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/tailwindlabs/tailwindcss-line-clamp/release-insiders.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-insiders.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/tailwindlabs/tailwindcss-line-clamp/release-insiders.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-insiders.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/tailwindlabs/tailwindcss-line-clamp/release-insiders.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/nodejs.yml:37
- Warn: npmCommand not pinned by hash: .github/workflows/release-insiders.yml:40
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 2 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 8 are checked with a SAST tool
Reason
10 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
3
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to @tailwindcss/line-clamp
tailwindcss-line-clamp
TailwindCSS plugin to generate webkit line clamp utilities
@neojp/tailwindcss-line-clamp-utilities
Tailwind CSS `line-clamp` utilities
postcss-clamp
PostCSS plugin to transform clamp() to combination of min/max
@twind/preset-line-clamp
A twind preset that provides utilities for visually truncating text after a fixed number of lines.