Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cleave.js

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cleave.js

JavaScript library for formatting input text content when you are typing

  • 0.7.23
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
250K
increased by4.81%
Maintainers
1
Weekly downloads
 
Created

What is cleave.js?

Cleave.js is a JavaScript library that helps you format input fields in real-time. It provides a simple way to format various types of input fields such as credit card numbers, phone numbers, dates, and more.

What are cleave.js's main functionalities?

Credit Card Number Formatting

This feature automatically formats credit card numbers as the user types. It adds spaces between every four digits for better readability.

new Cleave('.input-credit-card', { creditCard: true });

Phone Number Formatting

This feature formats phone numbers according to the specified region code. In this example, it formats phone numbers in the US format.

new Cleave('.input-phone', { phone: true, phoneRegionCode: 'US' });

Date Formatting

This feature formats date inputs according to the specified pattern. In this example, it formats the date in the 'YYYY-MM-DD' format.

new Cleave('.input-date', { date: true, datePattern: ['Y', 'm', 'd'] });

Numeral Formatting

This feature formats numerical inputs with thousand separators. It makes large numbers more readable by adding commas.

new Cleave('.input-numeral', { numeral: true, numeralThousandsGroupStyle: 'thousand' });

Custom Delimiter

This feature allows custom delimiters and block sizes for input formatting. In this example, it formats the input with dashes every four characters.

new Cleave('.input-custom', { delimiter: '-', blocks: [4, 4, 4, 4] });

Other packages similar to cleave.js

Keywords

FAQs

Package last updated on 02 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc