@bithero/react-autoresize-textarea
v1.0.1
Published
React component for an autoresizing textarea
Downloads
3
Maintainers
Readme
react-autoresize-textarea
React component for an autoresizing textarea
License
This project is licensed under AGPL-3.0. See the LICENSE
file for more informations.
Usage
Simply use the component as you would <textarea></textarea>
.
import React, { useState, useRef } from 'react';
import { AutoresizeTextarea } from '@bithero/react-autoresize-textarea';
const MyComponent = () => {
const [value, setValue] = useState();
const ref = useRef<HTMLTextAreaElement>(null); // you still can get an reference to the underlaying textarea
return (<div>
<label>Description</label>
<AutoresizeTextarea ref={ref} onInput={(e) => setValue(e.target.value)} value={value}/>
</div>);
}