• Stars
    star
    121
  • Rank 293,924 (Top 6 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created about 6 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Truncate strings like butter.

React Truncate String

Truncate strings like butter.

Build Status

Features

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

Requirements

This library relies on spaces for truncation. Thanks @dschinkel for pointing that out.

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 ยฉ 2020 Albino Tonnina

More Repositories

1

albinotonnina.com

source-code
JavaScript
2,639
star
2

react-magic-hat

๐ŸŽฉโœจLibrary to implement the Magic Hat technique, blazingly fast ๐Ÿš€
JavaScript
311
star
3

mmarkdown

Interpret mmd fenced code blocks in a markdown file and generate a cooler version of it.
JavaScript
76
star
4

parcel-plugin-inlinesvg

Parcel plugin to support inline SVG
JavaScript
62
star
5

javascript-data-structures-and-algorithms

Exercises, algorithms
JavaScript
54
star
6

react-redux-magichat-demo-booking-system

Simple room booking system, react, redux.
JavaScript
29
star
7

it.numidia.gridWidget

A titanium alloy widget for grids, using a tableview. Sample app provided.
JavaScript
26
star
8

react-app-boilerplate-2018

Bootstrap for a React App with Redux, React Router, Styled Components, Jest and Hot Reloading,
JavaScript
20
star
9

vanilla-js-demo-app

Vanilla JS demo app
JavaScript
12
star
10

hot-parcel-react

Exploring Parcel bundler and hot realod
JavaScript
11
star
11

vanilla-js-spa

Single page applications for a test, no libraries
JavaScript
9
star
12

parcel-plugin-wrapper

Parcel plugin that wraps output files with custom text or code
JavaScript
8
star
13

scrollytelling

Experimental layout
JavaScript
7
star
14

demo-magic-hat

๐ŸŽฉโœจDemo for react-magic-hat, blazingly fast ๐Ÿš€
JavaScript
7
star
15

larry

An approach to a modern custom Design System, flexible and iterable.
JavaScript
6
star
16

react-fake-checkbox-styled-components

Experimenting with styled components and design systems
JavaScript
2
star
17

puppetBot

C++
1
star
18

Bandit

CSS
1
star
19

jquery-scramble-scroll

Scramble elements as you scroll, that's just it :)
JavaScript
1
star
20

deck-secure-delegated-access-with-openid-connect

Deck for overview of OIDC
JavaScript
1
star
21

led-translator

English - Alienese Translator
CSS
1
star
22

feature-proposal-template

1
star
23

sudoku-solver-backtracking-algorithm

Learning to solve a sudoku with backtracking algorithms
JavaScript
1
star