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 🙏

© 2026 – Pkg Stats / Ryan Hefner

swapform

v1.1.5

Published

A front-end improvement to Bootstrap forms with a Material design.

Readme

Build version bootstrap version JS gzip size CSS gzip size vulnerabilities license

Table of contents

Quick start

What's included

swapform/
└── dist/
    ├── css/
    │   ├── swapform.css
    │   ├── swapform.css.map
    │   ├── swapform.min.css
    │   └── swapform.min.css.map
    └── js/
        ├── swapform.js
        ├── swapform.js.map
        ├── swapform.min.js
        └── swapform.min.js.map

Documentation

Quite simply, wrap an input or textarea in a <div> element with an sf-form class. Then add the sf-label class to the <label> element. Swapform will automatically perform everything else.

Input examples

Basic

<div class="sf-form">
    <label class="sf-label">Enter username</label>
    <input type="text" class="form-control">
</div>

Basic swap

Swapping label when focused

<div class="sf-form">
    <label class="sf-label" data-description="Who are you?">Enter username</label>
    <input type="text" class="form-control">
</div>

Basic swap

Swapping multiple labels when focused and when input value is filled

<div class="sf-form">
    <label class="sf-label" data-description="Who are you?" data-filled="That's what she said">
        Enter username
    </label>
    <input type="text" class="form-control">
</div>

Basic swap

Textarea examples

The <textarea> element supports the same swapping methods outlined above, and also supports automatic height expansion, fixed heights and multiple sizes. Below is a table listing the available classes for a <textarea> depending on the features and size desired.

Expanding Textarea

Classes for fixed heights and auto-expanding heights

| Class | Suffix | Sizes | Description | | --------------------- | ---------- | ------------------- | ---------------------------------------------------------- | | sf-textarea- | sm, md, lg | 160px, 320px, 640px | Automatically expands to a maximum height based on content | | sf-textarea-fixed- | sm, md, lg | 160px, 320px, 640px | Has a fixed height |

Basic, medium, fixed height

Class: sf-textarea-fixed-md

<div class="sf-form">
    <label class="sf-label">Tell me a story</label>
    <textarea class="form-control sf-textarea-fixed-md"></textarea>
</div>

Basic, large, expanding height

Class: sf-textarea-lg

<div class="sf-form">
    <label class="sf-label">Tell me a story</label>
    <textarea class="form-control sf-textarea-lg"></textarea>
</div>

Basic, large, expanding height, with swapping texts

Class: sf-textarea-lg

Focused: Surprise me!

Filled: Cool story bro

<div class="sf-form">
    <label class="sf-label" data-description="Surprise me!" data-filled="Cool story bro">Tell me a story</label>
    <textarea class="form-control sf-textarea-lg"></textarea>
</div>

Supported classes

Basic

| Class | Description | | --------- | ------------------------------------------------------------------------------ | | sf-form | Used to wrap around a <label> with an accompanying <input> or <textarea> |

Labels

| Class | Description | | ------------- | ------------------------------------------------------------------------------------ | | sf-label-sm | Should be used when using form-control-sm in your input/textarea elements | | sf-label | Should be used when using regular form-control in your input/textarea elements | | sf-label-lg | Should be used when using form-control-lg in your input/textarea elements |

Textarea

| Class | Description | | ---------------------- | --------------------------------- | | sf-textarea-sm | Auto expanding height up to 160px | | sf-textarea-md | Auto expanding height up to 320px | | sf-textarea-lg | Auto expanding height up to 640px | | sf-textarea | Auto expanding height infinitely | | sf-textarea-fixed-sm | Fixed height, 160px | | sf-textarea-fixed-md | Fixed height, 320px | | sf-textarea-fixed-lg | Fixed height, 640px |

Supported data attributes

These are used on <input> or <textarea> elements. The color and file input types are not supported at this time.

| Option | Description | | ------------------- | ------------------------------------------------------------------------------------------- | | data-description | The value is swapped in when a form input or textarea is focused | | data-filled | The value is swapped in when a form input or textarea has a value and is no longer focused |

Screenshots

Basic

Basic swap

Using HTML

HTML Swap

Using emojis

Emoji Swap

Auto expanding textarea

Expanding Textarea

Builds

If you are using the npm build, you can rebuild the compiled assets after making any desired changes by running any of the following commands:

| Option | Description | | ----------------- | ----------------------------------------------------------------------------------------- | | css-compile | Generates a non-minified version of the css and stores it in ./dist/css/swapform.css | | css-minify | Generates a minified version of the css and stores it in ./dist/css/swapform.min.css | | js-compile-dev | Generates a non-minified version of the javascript and stores it in ./js/dist/swapform.js | | js-minify-dev | Generates a minified version of the javascript and stores it in ./js/dist/swapform.min.js | | js-compile-prod | Generates a non-minified version of the javascript and stores it in ./dist/js/swapform.js | | js-minify-prod | Generates a minified version of the javascript and stores it in ./dist/js/swapform.min.js |

All the above commands also generate source maps

Todo

  • Add a new method to detect errors on form validation and allow handling

Creator

Robert Miller