# josephschmitt/Clamp.js

Clamps an HTML element by adding ellipsis to it if the content inside is too long.

Repository: https://github.com/josephschmitt/Clamp.js
Canonical: https://ross.abutalabs.com/products/clampjs
Homepage: http://joe.sh/clamp-js
Language: JavaScript
License Family: other
Last push: 2018-11-30T17:06:17+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 5717, "days_push": 2833, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases, no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2421, forks 750 (observed 2026-08-28T04:06:50.568575+00:00)

## What it is
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
- artifact type: library
- maturity: abandoned
- function: ui-components, frontend-framework
- domain: web-development, frontend
- platform: browser, cross-platform
- tags: text-truncation, ellipsis, line-clamp, vanilla-javascript, dom

## Member repositories
- josephschmitt/Clamp.js (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:50.568575+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:33:03.498838+00:00, confidence not recorded.
  - readme: https://github.com/josephschmitt/Clamp.js (fetched 2026-08-28T04:06:50.568575+00:00, sha 90b4ced4b4d8)
  - homepage: http://joe.sh/clamp-js (fetched 2026-08-29T10:13:46.750477+00:00, sha 455a241bdd23)
- Data as of 2026-08-30T08:39:29.467469+00:00.
