A lightweight React component for formatting input fields based on a template pattern (e.g., phone numbers, postal codes, credit card numbers). Version 1.2.8, actively maintained. Provides mask-like formatting with alphanumeric (`#`), numeric (`9`), and special character (`@`) placeholders. Uses browser-only DOM APIs, so it requires a Client Component in Next.js App Router. Ships TypeScript definitions.
npm install react-input-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Example of using FormattedInput with a template that formats alphanumeric input as '###-###'.
Wrap the component in a Client Component by adding 'use client' directive in Next.js App Router.
Use correct package name: import { FormattedInput } from 'react-input-formatter'Refer to documentation: # = alphanumeric, 9 = numeric only, @ = special character.
Always provide a defaultValue string, even if empty.
Ensure component is only used in a Client Component with 'use client' directive.
Use correct package name: import { FormattedInput } from 'react-input-formatter'