# @tailwindcss/line-clamp

> A plugin that provides utilities for visually truncating text after a fixed number of lines.

Latest version **0.4.4** (published 2023-03-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tailwindcss/line-clamp
pnpm add @tailwindcss/line-clamp
yarn add @tailwindcss/line-clamp
bun add @tailwindcss/line-clamp
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.4 |
| Published | 2023-03-30 |
| First published | 2021-01-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 18.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | thecrypticace, reinink, adamwathan, bradlc, malfaitrobin |

## Links

- npm: https://www.npmjs.com/package/@tailwindcss/line-clamp
- Repository: https://github.com/tailwindlabs/tailwindcss-line-clamp
- Homepage: https://github.com/tailwindlabs/tailwindcss-line-clamp#readme
- Issues: https://github.com/tailwindlabs/tailwindcss-line-clamp/issues
- npm.io page: https://npm.io/package/@tailwindcss/line-clamp

## Recent versions

- 0.4.4 (latest) — 2023-03-30
- 0.0.0-insiders.3d5079f (insiders) — 2026-05-12
- 0.0.0-insiders.19dfa60 — 2025-02-13
- 0.0.0-insiders.df16d50 — 2024-03-22
- 0.0.0-insiders.3434005 — 2023-03-31
- 0.0.0-insiders.448cb33 — 2023-03-31
- 0.0.0-insiders.9b1fc08 — 2023-03-30
- 0.4.3 — 2023-03-30
- 0.0.0-insiders.b270198 — 2023-03-30
- 0.0.0-insiders.7482e83 — 2023-03-30
- 0.0.0-insiders.06f3ad8 — 2022-09-19
- 0.4.2 — 2022-09-02
- 0.0.0-insiders.a18c411 — 2022-09-02
- 0.0.0-insiders.962d093 — 2022-09-02
- 0.0.0-insiders.0b53e7a — 2022-09-02
- … 25 more at https://npm.io/package/@tailwindcss/line-clamp/versions

## README

# @tailwindcss/line-clamp

A plugin that provides utilities for visually truncating text after a fixed number of lines.


## Installation

Install the plugin from npm:

```sh
npm install -D @tailwindcss/line-clamp
```

Then add the plugin to your `tailwind.config.js` file:

```js
// tailwind.config.js
module.exports = {
  theme: {
    // ...
  },
  plugins: [
    require('@tailwindcss/line-clamp'),
    // ...
  ],
}
```

## Usage

Use the `line-clamp-{n}` utilities to specify how many lines of text should be visible before truncating:

```html
<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`:

```html
<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>
```

> Note that the `line-clamp-{n}` set other properties like `display` and `overflow` in addition to `-webkit-line-clamp` which are not unset by `line-clamp-none`, so depending on what you are trying to achieve you may need to explicitly override those properties with utilities like `flex` or `overflow-visible` as well.

Utilities are for clamping text up to 6 lines are generated by default:

| Class  | CSS |
| ---  | --- |
| `line-clamp-1` |  `overflow: hidden;`<br>`display: -webkit-box;`<br>`-webkit-box-orient: vertical;`<br>`-webkit-line-clamp: 1;` |
| `line-clamp-2` |  `overflow: hidden;`<br>`display: -webkit-box;`<br>`-webkit-box-orient: vertical;`<br>`-webkit-line-clamp: 2;` |
| `line-clamp-3` |  `overflow: hidden;`<br>`display: -webkit-box;`<br>`-webkit-box-orient: vertical;`<br>`-webkit-line-clamp: 3;` |
| `line-clamp-4` |  `overflow: hidden;`<br>`display: -webkit-box;`<br>`-webkit-box-orient: vertical;`<br>`-webkit-line-clamp: 4;` |
| `line-clamp-5` |  `overflow: hidden;`<br>`display: -webkit-box;`<br>`-webkit-box-orient: vertical;`<br>`-webkit-line-clamp: 5;` |
| `line-clamp-6` |  `overflow: hidden;`<br>`display: -webkit-box;`<br>`-webkit-box-orient: vertical;`<br>`-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:

```js
// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      lineClamp: {
        7: '7',
        8: '8',
        9: '9',
        10: '10',
      }
    }
  },
  variants: {
    lineClamp: ['responsive', 'hover']
  }
}
```

---
_Source: https://npm.io/package/@tailwindcss/line-clamp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
