百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

floatl

> 数据库
开源

:cloud: 一个针对 Web 的浮动标签模式的实用实现

199 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

:cloud: 一个针对 Web 的浮动标签模式的实用实现

☁️ Floatl

A pragmatic implementation of the Float Label Pattern for the web.

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

Features

Supports textfields and textareas

Dependency-free and maintained

⚡️ Small size, Oldie browser support

* 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.

bash
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, AngularJS and Stimulus.

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

xml

Instantiate Floatl by passing in the wrapping DOM element:

javascript
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:

javascript
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.

Issues· 26 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptfloating-labelsformjavascriptplaceholder

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库