Cleave.js is a JavaScript library that applies real-time visual formatting to form fields as users type. It provides specialized utilities to enforce visual patterns for credit cards, phone numbers, dates, times, and large numerals.
The library includes predefined formatting rules for common data types, such as detecting credit card issuers to apply correct spacing and managing country-specific regional patterns for international phone numbers. It also supports large numeral grouping using Western, Indian, and Chinese numbering systems.
Users can define custom input patterns using specific block lengths, delimiters, and prefixes to create specialized text constraints. The toolset also covers input management, allowing for the retrieval of both formatted and raw field values, programmatic value updates, and the cleanup of active event listeners.