
Security News
PyPI Expands Trusted Publishing to GitLab Self-Managed as Adoption Passes 25 Percent
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads
@twind/line-clamp
Advanced tools
A twind plugin that provides utilities for visually truncating text after a fixed number of lines.
A plugin for Twind that provides utilities for visually truncating text after a fixed number of lines.
Based on @tailwindcss/line-clamp.
Install from npm:
# Using npm
npm install @twind/line-clamp
# Using Yarn
yarn add @twind/line-clamp
Use the lineClamp(lines) function to specify how many lines of text should be visible before truncating:
import { lineClamp } from '@twind/line-clamp'
document.body.innerHTML = `
<p class="${tw`max-w-xs mx-auto ${lineClamp(3)}`}">
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.
</p>
`
To remove any line-clamping, use lineClamp('none'):
document.body.innerHTML = `
<p class="${tw`max-w-xs mx-auto ${lineClamp(3)} md:${lineClamp('none')}`}">
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.
</p>
`
Note that the
lineClamp(lines)set other properties likedisplayandoverflowin addition to-webkit-line-clampwhich are not unset bylineClamp('none'), so depending on what you are trying to achieve you may need to explicitly override those properties with utilities likeflexoroverflow-visibleas well.
Add the plugin to plugins of your setup call:
import { lineClamp } from '@twind/line-clamp'
setup({
plugins: {
'line-clamp': lineClamp,
},
})
Use the line-clamp-{n} utilities to specify how many lines of text should be visible before truncating:
<p class="line-clamp-3">
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.
</p>
To remove any line-clamping, use line-clamp-none:
<p class="line-clamp-3 md:line-clamp-none">
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.
</p>
A lineClamp section is added to the theme. Its values are used for looking up the value. If no value us found the given parameter is used.
setup({
theme: {
lineClamp: {
card: '5',
},
},
})
tw(lineClamp('card'))
// => -webkit-line-clamp:5
// Not found in theme => use as is
tw(lineClamp('7'))
// => -webkit-line-clamp:7
FAQs
A twind plugin that provides utilities for visually truncating text after a fixed number of lines.
We found that @twind/line-clamp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.