@namhong2001/react-textfit
v2.0.0
Published
React component to fit headlines and paragraphs into any element
Downloads
834
Maintainers
Readme
@namhong2001/react-textfit
v1
Diff from malte-wessel/react-textfit
- make run possible on react v18
Install
npm install @namhong2001/react-textfit@1
Types
npm install @types/namhong2001__react-textfit@npm:@types/react-textfit --D
v2
Originate from malte-wessel/react-textfit but fully rewritten with function component and hooks by typescript
Install
npm install @namhong2001/react-textfit
Types
Included
Supported props
mode
(single|multi) force singleline or multiline. defaultmulti
min
(Number) minimum font size. default0
max
(Number) maximum font size. default300
example
<Textfit>
{myText}
</Textfit>
<Textfit mode="single">
{myText}
</Textfit>
<Textfit mode="single" min={10} max={50}>
{myText}
</Textfit>
LICENSE
MIT