Skip to content
Truncate strings like butter.
JavaScript HTML
Branch: master
Clone or download

Latest commit

rdonnelly and albinotonnina Fix truncateAt prop in example (#5)
Change `truncate` to `truncateAt`
Latest commit f80b6a2 Mar 14, 2019

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode 🛠 tests Aug 24, 2018
src accept truncateAt prop Aug 27, 2018
test-lib First refactor fix derive update (#1) Aug 27, 2018
.babelrc 🛠 tests Aug 24, 2018
.eslintrc 🛠 tests Aug 24, 2018
.gitignore gitgnore Aug 24, 2018
.prettierrc 🚀 init Aug 23, 2018
.travis.yml 🛠 tests Aug 24, 2018
LICENSE.md 🚀 init Aug 23, 2018
README.md Fix truncateAt prop in example (#5) Mar 14, 2019
jest-puppeteer-react.config.js First refactor fix derive update (#1) Aug 27, 2018
jest-puppeteer.config.js First refactor fix derive update (#1) Aug 27, 2018
package.json v1.3.0 Aug 27, 2018
rollup.config.js 🛠 truncateString Aug 23, 2018
yarn.lock First refactor fix derive update (#1) Aug 27, 2018

README.md

React Truncate String

Truncate strings like butter.

Build Status

Features

It truncates long long long long...long long strings in the middle!

demo: https://albinotonnina.github.io/react-truncate-string

🚀 ultra-blazingly-fast

🌈 ultra-light: 1.76 KB

Table of Contents

Install

yarn add react-truncate-string

Usage

Truncate in the middle of the string

import TruncateString from 'react-truncate-string'

...

render(){

    return  <TruncateString text="your long string" />
}

Truncate the string at 90%

import TruncateString from 'react-truncate-string'

...

render(){
    return  <TruncateString text="your long string" truncateAt={90} />
}

Demos

https://albinotonnina.github.io/react-truncate-string

https://codesandbox.io/s/xvv9r5ozo

Maintainers

@albinotonnina

Contribute

PRs accepted.

TODO

  • truncate by words?
  • min start and end characters option?
  • change debounce time with option?

License

MIT © 2018 Albino Tonnina

You can’t perform that action at this time.