Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/albinotonnina/react-truncate-string
Truncate strings like butter.
https://github.com/albinotonnina/react-truncate-string
react truncate truncate-text
Last synced: 6 days ago
JSON representation
Truncate strings like butter.
- Host: GitHub
- URL: https://github.com/albinotonnina/react-truncate-string
- Owner: albinotonnina
- License: apache-2.0
- Created: 2018-08-23T15:34:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-26T01:14:29.000Z (almost 2 years ago)
- Last Synced: 2024-12-08T20:47:57.611Z (14 days ago)
- Topics: react, truncate, truncate-text
- Language: JavaScript
- Homepage: https://albinotonnina.github.io/react-truncate-string/
- Size: 1.2 MB
- Stars: 121
- Watchers: 3
- Forks: 8
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# React Truncate String
> Truncate strings like butter.
[![Build Status](https://travis-ci.org/albinotonnina/react-truncate-string.svg?branch=master)](https://travis-ci.org/albinotonnina/react-truncate-string)
## Features
### It truncates long long long long...long long strings in the middle!
## Requirements
This library relies on spaces for truncation. Thanks [@dschinkel](https://github.com/dschinkel) for [pointing that out](https://github.com/albinotonnina/react-truncate-string/issues/7).
## demo: https://albinotonnina.github.io/react-truncate-string
🚀 ultra-blazingly-fast
🌈 ultra-light: 1.76 KB
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [Demos](#demos)
- [Maintainers](#maintainers)
- [Contribute](#contribute)
- [TODO](#todo)
- [License](#license)## Install
```
yarn add react-truncate-string
```## Usage
### Truncate in the middle of the string
```jsx
import TruncateString from 'react-truncate-string'...
render(){
return
}
```### Truncate the string at 90%
```jsx
import TruncateString from 'react-truncate-string'...
render(){
return
}
```## Demos
https://albinotonnina.github.io/react-truncate-string
https://codesandbox.io/s/xvv9r5ozo
## Maintainers
[@albinotonnina](https://github.com/albinotonnina)
## Contribute
PRs accepted.
## TODO
- truncate by words?
- min start and end characters option?
- change debounce time with option?## License
MIT © 2020 Albino Tonnina