JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4014
  • Score
    100M100P100Q123077F
  • License MIT

Automatically expand a <textarea> to fit its content, in a few bytes

Package Exports

  • fit-textarea

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fit-textarea) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fit-textarea

Automatically expand a <textarea> to fit its content, in a few bytes

Install

npm install fit-textarea

Setup

const fitTextarea = require('fit-textarea');
import fitTextarea from 'fit-textarea';
<textarea rows="3">Use the rows attribute to set its minimum height</textarea>

Usage

Once, one element

const textarea = document.querySelector('textarea');
fitTextarea(textarea);

As the user types

One element

const textarea = document.querySelector('textarea');
fitTextarea.watch(textarea);

Array/NodeList/Iterable of elements

const textareas = document.querySelectorAll('textarea');
fitTextarea.watch(textareas);

With a selector

The selector is run once, so it's equivalent to the example above.

fitTextarea.watch('textarea');

Related

  • indent-textarea - Add editor-like tab-to-indent functionality to