1.1.0 • Published 3 years ago

react-use-tag-truncator v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

useTagTruncator

Installation


yarn add react-use-tag-truncator
npm install react-use-tag-truncator

TODO


Minor stuff need to be done in project:

  • Fix remaining flowtype errors
  • Demo
  • Test

Usage


import useTagTruncator from "react-use-tag-truncator";

const App = () => {
  const [
    containerRef,
    isExtended,
    toggleExtend,
    hiddenCount,
  ] = useTagTruncator();
  
  return (
    <ul
      ref={containerRef}
      style={{
        height: isExtended ? "none" : "65px",
        width: "300px",
        display: "flex",
        flexWrap: "wrap",
      }}
    >
      {Array.from({ length: 26} ).map((_, index) => (
        <li key={index}>item #{index + 1}</li>
      ))}
      <li onClick={toggleExtend}>
        {isExtended ? "Hide" : `+ ${hiddenCount} more...`}
      </li>
    </ul>
  )
}

Licence


MIT


Credit to react-truncate-list

1.1.0

3 years ago

1.0.8-rc

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago