React component for an autoresizing textarea
Go to file
Mai Lapyst f7c699563d Fixing packaging to not include .js files from example; release v1.0.1 2022-07-20 16:56:21 +02:00
example Initial commit; v1.0.0 2022-07-18 23:15:05 +02:00
src Initial commit; v1.0.0 2022-07-18 23:15:05 +02:00
.gitignore Fixing packaging to not include .js files from example; release v1.0.1 2022-07-20 16:56:21 +02:00
LICENSE Initial commit; v1.0.0 2022-07-18 23:15:05 +02:00
package.json Fixing packaging to not include .js files from example; release v1.0.1 2022-07-20 16:56:21 +02:00
readme.md Initial commit; v1.0.0 2022-07-18 23:15:05 +02:00
tsconfig.json Initial commit; v1.0.0 2022-07-18 23:15:05 +02:00
yarn.lock Initial commit; v1.0.0 2022-07-18 23:15:05 +02:00

readme.md

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