@ataverascrespo/react18-ts-textfit

1.0.0 • Public • Published

@ataverascrespo/react18-ts-textfit

  • New version of the react-textfit package, updated for React 18 and TypeScript by Alex Taveras-Crespo
  • Fit headlines and paragraphs into any element by using binary search to find the correct fit

Installation

npm install @ataverascrespo/react18-ts-textfit

Usage

Props

  • mode - "single" | "multi" (default)
  • forceSingleModeWidth - boolean - ignore element height when true and mode is single (default = true)
  • mix - number - min font size
  • max - number - max font size
  • throttle - number - window resize throttle in milliseconds
  • onReady function - called when text is fitted.

Examples

<Textfit mode="single">
     Hello World!
</Textfit>
<Textfit mode="multi" forceSingleModeWidth={true} min={24} max={64}>
     Hello World!
</Textfit>

License

MIT

Package Sidebar

Install

npm i @ataverascrespo/react18-ts-textfit

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

20.9 kB

Total Files

19

Last publish

Collaborators

  • ataverascrespo