# react-ellipsis-pjs

> React Component for Ellipsis

Latest version **2.1.2** (published 2020-01-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-ellipsis-pjs
pnpm add react-ellipsis-pjs
yarn add react-ellipsis-pjs
bun add react-ellipsis-pjs
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2020-01-21 |
| First published | 2018-10-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Nelayah |
| Maintainers | nelayah |
| Keywords | react, ellipsis, typescript |

## Links

- npm: https://www.npmjs.com/package/react-ellipsis-pjs
- Repository: https://github.com/Nelayah/React-Ellipsis
- Homepage: https://github.com/Nelayah/React-Ellipsis#readme
- Issues: https://github.com/Nelayah/React-Ellipsis/issues
- npm.io page: https://npm.io/package/react-ellipsis-pjs

## Dependencies (1)

- [@juggle/resize-observer](https://npm.io/package/@juggle/resize-observer.md) ^3.0.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.1.2 (latest) — 2020-01-21
- 2.1.0 — 2020-01-21
- 2.0.0 — 2020-01-21
- 1.0.0 — 2020-01-21
- 0.0.11 — 2020-01-21
- 0.0.10 — 2020-01-21
- 0.0.9 — 2018-11-22
- 0.0.8 — 2018-10-29
- 0.0.7 — 2018-10-28
- 0.0.6 — 2018-10-28
- 0.0.5 — 2018-10-28
- 0.0.4 — 2018-10-28

## README

# React Ellipsis PJS

React Ellipsis PJS is a [React](http://facebook.github.io/react/) component that lets Cross-browser multiline text ellipsis.

[![NPM](https://img.shields.io/npm/v/react-ellipsis-pjs.svg)](https://www.npmjs.com/package/react-ellipsis-pjs)

## Installation

react-ellipsis-pjs@2 requires React v16.8.0 or higher with React Hooks support.

```bash
npm i --save-dev react-ellipsis-pjs
```

The react-ellipsis-pjs@1 using React Class supports React v16.0.0 or higher.

```bash
npm i --save-dev react-ellipsis-pjs@1.0.0
```
The V1 documentation can be found in the [README_v1](README_v1.md)

## Basic Usage

```jsx
import React from 'react';
import Ellipsis from 'react-ellipsis-pjs';

const text = `React makes it painless to create interactive UIs
Design simple views for each state in your application,
and React will efficiently update and render just the right`;

<Ellipsis text={text} /> 

// Render: React makes it painless to create interactive UIs...
```

## Custom Suffix And Lines

```jsx
<Ellipsis text={text} lines={2} suffix=" - For detail..." /> 

// Render: 
// React makes it painless to create interactive UIs
// Design simple views for each state in your application, - For detail...
```

## Custom Text Ellipsis Or Not

```jsx
import { Tooltip } from 'antd';

<Ellipsis
  text={text}
  render={(ellipsisText, isEllipsis) => {
    if (!isEllipsis) return ellipsisText;
    return (
      <Tooltip title={text}>{ellipsisText}</Tooltip>
    );
  }}
/>
```

## Props
Property | Type | Default | Description
-|-|-|-
text | string | - | Current value
suffix | string | '...' | When the text ellipsis, the suffix string for the text.
lines | number | 1 | Submitting a number controls the number of lines that should be displayed.
render | (ellipsisText: string, isEllipsis: boolean) => React.ReactNode | - | The function that returns a ReactNode will overwrite the default one.
style | React.CSSProperties | - | Change React Ellipsis PJS Componen Style

---
_Source: https://npm.io/package/react-ellipsis-pjs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
