textarea-autosizer
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

Textarea Autosizer [dependency-free]

Textarea Autosizer automatically resizes the height of a textarea based on the content entered or pasted inside it.

Live example

Getting Started

  1. Install
  2. Examples
  3. Methods

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.

Package Sidebar

Install

npm i textarea-autosizer

Weekly Downloads

156

Version

0.0.5

License

ISC

Unpacked Size

19.3 kB

Total Files

9

Last publish

Collaborators

  • raphpare