Skip to content

React component that clamps the content of an element by adding an ellipsis to it if the content inside is too long.

License

Notifications You must be signed in to change notification settings

clampy-js/react-clampy

Repository files navigation

@clampy-js/react-clampy

React component that clamps the content of an element by adding an ellipsis to it if the content inside is too long.

Build Status GitHub issues GitHub license npm

It uses @clampy-js/clampy library (a fork of Clamp.js) behind the scene to apply the ellipsis.

It automatically re-clamps itself when the element or the browser window change size.

Install

npm install --save @clampy-js/react-clampy

Usage

import React, { Component } from 'react'

import Clampy from '@clampy-js/react-clampy'

class Clampy extends Component {
  render () {
    return (
      <Clampy clampSize="2">My long text to clamp</Clampy>
    )
  }
}

License

MIT © alexandremoore

About

React component that clamps the content of an element by adding an ellipsis to it if the content inside is too long.

Resources

License

Stars

Watchers

Forks

Packages

No packages published