react-contain-textbox
v0.1.3
Published
Resize your text to fit a box
Downloads
7
Readme
React Contain Textbox
Resize your text and other stuff to fit a box.
Anything can be contained so long as em
is used in it's sizing!
Installation
npm i react-contain-textbox
Examples
ES6
import React, { useRef } from 'react';
import useContain from 'react-contain-textbox';
const App = (props) => {
const boxRef = useRef();
useContain(boxRef);
return (
<div
ref={boxRef}
style={{
height: 100,
width: 100,
}}
>
<p>Buncha stuff to resize!</p>
<img
src="image.png"
style={{ height: '5em', width: '5em' }}
alt="This will too if you use em"
/>
</div>
);
};
License
Copyright (c) 2020, Michael Szmadzinski. (MIT License)