1.0.1 • Published 2 years ago

@bithero/react-autoresize-textarea v1.0.1

Weekly downloads
-
License
AGPL-3.0-or-later
Repository
-
Last release
2 years ago

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>);
}