Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 491 Bytes

README.md

File metadata and controls

34 lines (23 loc) · 491 Bytes

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.