josephschmitt/Clamp.js
Clamps an HTML element by adding ellipsis to it if the content inside is too long. observed · 2026-08-28
Health v2 · maintenance only
32/100
- Activity 0
- Release rhythm 35
- Longevity 100
Flags: no_releases no_license
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 5717
- days_rel: n/a
- days_push: 2833
- n_releases_24m: 0
Adoption not part of the score
2421 stars · 750 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
Clamp.js is a small vanilla JavaScript library that truncates HTML element content with an ellipsis when it exceeds a specified number of lines or height. It works cross-browser, optionally leveraging the native -webkit-line-clamp where available.
Use cases
- truncate long text to a fixed number of lines with an ellipsis
- clamp dynamic content to a fixed pixel height
- add a read more link at the end of truncated text
- cross-browser line clamping without experimental CSS
- auto-clamp content to fit available container space
When to choose
- you need multi-line text truncation in older browsers lacking CSS line-clamp support
- you want a dependency-free vanilla JS solution
- you need custom truncation characters or trailing HTML like a read-more link
When to avoid
- your target browsers support the modern CSS line-clamp property
- the project needs an actively maintained library
- you use a framework with built-in truncation utilities
Facets
library · maturity abandoned
ui-components frontend-framework web-development frontend browser cross-platform text-truncation ellipsis line-clamp vanilla-javascript dom
2 sources
- readme: https://github.com/josephschmitt/Clamp.js · fetched 2026-08-28 · 90b4ced4b4d8
- homepage: http://joe.sh/clamp-js · fetched 2026-08-29 · 455a241bdd23
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| josephschmitt/Clamp.js | main | 32 |
For agents
markdown · JSON · MCP: product_card(name="josephschmitt/Clamp.js")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem