Skip to content

Latest commit

 

History

History

textarea

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Textarea

Auto-resizing textarea


Usage

Install the package

npm i -S @stormid/textarea

Import the module

import textarea from '@stormid/textarea';

Initialise the module via selector string

const [ instance ] = boilerplate('.js-boilerplate');

Initialise with a DOM element

const element = document.querySelector('textarea');
const [ instance ] = textarea(element);

Initialise with a Node list

const elements = document.querySelectorAll('textarea');
const [ instance ] = textarea(elements);

Initialise with an Array of elements

const elements = [].slice.call(document.querySelectorAll('textarea'));
const [ instance ] = textarea(elements);

Options

{
    events: [
        'input' //default textarea resize event
    ]
}

API

textarea() returns an array of instances. Each instance exposes the interface

{
    node, DOMElement, the text area
    resize, Function to trigger resize
}

Tests

npm t

License

MIT