use-text-fit
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

use-text-fit

npm version

A hook used to fit text in one line inside its container.


Install

npm install use-text-fit

Usage

import useTextFit from 'use-text-fit';


function Title() {
    const {ref} = useTextFit();

    return <div ref={ref}>
        Lorem Ipsum
    </div>;
}
  1. Pass the ref to the text container element.
  2. Profit.

Readme

Keywords

none

Package Sidebar

Install

npm i use-text-fit

Weekly Downloads

130

Version

2.0.1

License

MIT

Unpacked Size

5.02 kB

Total Files

5

Last publish

Collaborators

  • itayganor