textarea-autosizer
v0.0.5
Published
Textarea Autosizer automatically resizes the height of a textarea based on the content entered or pasted inside it.
Downloads
135
Maintainers
Readme
Textarea Autosizer [dependency-free]
Textarea Autosizer automatically resizes the height of a textarea based on the content entered or pasted inside it.
Getting Started
Install
npm
npm i textarea-autosizer --save
Yarn
yarn add textarea-autosizer
Examples
HTML
<textarea></textarea>
TypeScript
setTextareaAutosizer() Fonction
import { setTextareaAutosizer } from 'textarea-autosizer';
const refTextarea = document.querySelector('textarea');
const textareaAutosizer = setTextareaAutosizer(refTextarea);
// Remove textareaAutosizer
// textareaAutosizer.remove();
TextareaAutosizer Class
import { TextareaAutosizer } from 'textarea-autosizer';
const refTextarea = document.querySelector('textarea');
const textareaAutosizer = new TextareaAutosizer();
textareaAutosizer.set(refTextarea);
Methods
TextareaAutosizer.set(htmlTextAreaElement, options)
Initializing the Textarea Autosizer.
Options
| Attribute | Description |
| -- | -- |
| minHeight?: number
| Minimum height of textarea |
| maxHeight?: number
| Maximum height of textarea |
TextareaAutosizer.remove()
Remove automatic textarea resizing.