@ataverascrespo/react18-ts-textfit
v1.0.0
Published
Updated for React 18 and TypeScript; a React component to fit headlines and paragraphs into any element.
Maintainers
Readme
@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-textfitUsage
Props
mode- "single" | "multi" (default)forceSingleModeWidth- boolean - ignore element height when true and mode is single (default = true)mix- number - min font sizemax- number - max font sizethrottle- number - window resize throttle in millisecondsonReadyfunction - 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
