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

floatl

v2.0.1

Published

A pragmatic implementation of the Float Label Pattern

Downloads

1,450

Readme

Floatl

A pragmatic implementation of the Float Label Pattern.

NPM Build Status Maintainability Test Coverage

Floatl

Try it for yourself: https://richardvenneman.github.io/floatl/

Features

🤙 Supports textfields and textareas

🏝 Dependency-free and maintained

⚡️ Small size, < 1Kb gzipped

* Supports IE8 & IE9 as well, but I couldn't get them to run on SauceLabs 😰

Installation

Floatl is built primarily for module bundlers such as Browserify and webpack. As such it is distributed via NPM.

yarn add floatl # or npm i -S floatl

An UMD build is available from the GitHub releases page if you're not using a module bundler. This version adds Floatl to the global namespace.

Styling

Add the required styling to your app. Please refer to the GitHub wiki page on styling for more information.

Usage

NOTE: Check the GitHub wiki page for instructions on how to use with React & Angular.

Markup your label and input (or textarea) with the floatl classes and wrap them in an element with the floatl class:

<div class="floatl">
  <label for="first_name" class="floatl__label">First name</label>
  <input name="first_name" class="floatl__input" placeholder="First name" type="text" />
</div>

Instantiate Floatl by passing in the wrapping DOM element:

import Floatl from "floatl";

var element = document.getElementById("my-floatl-element");
new Floatl(element);

Destroying instances

If you keep a reference to your Floatl instance, it's easy to remove all of the event handlers by calling the destroy instance method:

var myFloatl = new Floatl(element);
myFloatl.destroy()

Placeholder polyfilling

While the JavaScript supports IE8+, Floatl aims to be good at Floating Labels and only that. The Floating Labels Pattern works best with placeholders and it is therefor recommended to install legacy browser placeholder support should you need it, for example Placekeeper or Placeholders.js.

Motivations

There are several libraries available that implement the Float Label Pattern, most notably floatlabels.js and FloatLabel.js. However, these libraries did not quite fulfill the requisites I had in mind (see features above) and I did not find any Bower compatible libraries when I started this project. Furthermore I like to use a well-maintained library. Since we're using this library in production at CitySpotters I'm keeping this library up to date.

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

  • Report bugs
  • Fix bugs and submit pull requests
  • Write, clarify, or fix documentation
  • Suggest or add new features
  • Write missing tests
  • Improve the TypeScript implementation

Development & testing

This project uses Jasmine with the Karma Test Runner.

  • Install dependencies with yarn install
  • Run the test suite with: yarn test (or yarn run tdd for Test Driven Development)

License

This library is released under the MIT License.

528 × 448 264x224