An easy to use replacement for textarea that can automatically resizes both horizontally and vertically as content changes.
import { AutoTextArea } from 'react-textarea-auto-witdth-height'
const somePlace = () => (
<div>
<AutoTextArea/>
</div>
)
https://react-textarea-auto-witdth-height-8j96.vercel.app/
npm i react-textarea-auto-witdth-height
Props are almost identical as native textarea, except rows
and cols
are not supported, please use min-height
and max-height
to style the component instead.
Reference the inner textarea
<TextareaAutosize ref={(ref) => (this.current = ref)} />
Then focus on the ref
this.current.focus();