npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

customtextarea

v1.0.12

Published

Provides extended functionality to the default HTML5 textarea form control.

Downloads

4

Readme

customtextarea

This package provides extended functionality for the HTML5 TextArea form element.

Contents:

Features

Maximum Line Validation

This features provides a method of enforcing a maximum number of lines on a HTML5 TextArea. Why? Say you had a form with a text area, and this form was being converted into a printable format, like a PDF. The text may have to fit into a certain area on your PDF, what this allows you to do is to limit the user input to a specific number of rows so that your PDF structure is maintained.

Usage

To use this feature, include the package in the relevant JS/TS file:

import * as CustomTextArea from 'customtextarea';

Then set up your TextArea element, ensuring you set an id, rows and cols value:

<TextArea id='MyTextArea' rows="5" cols="85"></TextArea>

After that all you need to do is call the validateMaxLines(textAreaSelector) method upon page load.

pageLoadFunction() {
    CustomTextArea.validateMaxLines('#MyTextArea');
}

If you would prefer not to use the rows attribute as the max rows, just pass in an override value to the setup function.

CustomTextArea.validateMaxLines('#MyTextArea', 10);

And that's it! The method adds an eventListener to the DOM that "hijacks" the user input at the point where it would wrap above the maximum rows.

Install

npm install customtextarea

License

MIT