AI · MCP Server and Agent Skills included

React Input Mask for valid data, now easier to build with AI

Let users enter only valid phone numbers, dates, card numbers, and product keys with standard masks, custom characters, regular expressions, prompt characters, and adornments. AI assistants set it up for you from the current docs.

  • 4.5/5 850+ G2 reviews
  • 4.6/5 950+ Capterra reviews
  • WCAG 2.2 and Section 508
  • 13 standard mask elements
  • Regex mask elements

Trusted by the world’s leading companies

Syncfusion customers include Visa, Apple, McDonald’s, Netflix, Starbucks, IBM, Tesla, and Schneider Electric

Now easier with AI

Build React masked inputs faster with AI

Coding assistants write the setup from the current docs instead of guessing.

01For developers

Describe an input format and get code that uses the documented API

The Syncfusion MCP server and Agent Skills give assistants in VS Code, Cursor, and JetBrains the current Input Mask docs and recommended patterns.

See all 25 features

AI coding assistantMCP Server · Syncfusion React

Mask the phone field as 000-000-0000 and the birth date as 00/00/0000.

search_docs“React Input Mask standard masks” · 2 doc sections

Excerpt: imports and sample data omitted.

+<MaskedTextBoxComponent

+ mask="000-000-0000"

+ placeholder="Mobile Number"

+ floatLabelType="Always"

+/>

+<MaskedTextBoxComponent

+ mask="LL / LL"

+ placeholder="Country ISO Code"

+ floatLabelType="Always"

+/>

+<MaskedTextBoxComponent

+ mask="00/00/0000"

+ placeholder="D.O.B"

+ floatLabelType="Always"

+/>

+<MaskedTextBoxComponent

+ mask="AAAAA-AAAAA-AAAAA-AAAAA"

+ placeholder="Product Key"

+ floatLabelType="Always"

+/>

Documented API: mask

ResultRendered in your app

AI coding assistantMCP Server · Syncfusion React

Accept a time such as 10:00 PM, where P can be A or P.

search_docs“React Input Mask custom characters” · 2 doc sections

Excerpt: imports and sample data omitted.

+<MaskedTextBoxComponent

+ mask="00:00 >PM"

+ placeholder="Time (ex: 10:00PM, 10:00AM)"

+ floatLabelType="Always"

+ customCharacters={{ P: 'P,A,p,a', M: 'M,m' }}

+/>

+<MaskedTextBoxComponent

+ mask="[0-2][0-9][0-9].[0-2][0-9][0-9].[0-2][0-9][0-9].[0-2][0-9][0-9]"

+ floatLabelType="Always"

+ placeholder="Ip address (ex: 212.212.111.222)"

+></MaskedTextBoxComponent>

Documented API: mask, customCharacters

ResultRendered in your app

AI coding assistantMCP Server · Syncfusion React

Mask an IPv4 address with a rule for each digit.

search_docs“React Input Mask regular expressions” · 2 doc sections

Excerpt: imports and sample data omitted.

+<MaskedTextBoxComponent

+ mask="[0-2][0-9][0-9].[0-2][0-9][0-9].[0-2][0-9][0-9].[0-2][0-9][0-9]"

+ floatLabelType="Always"

+ placeholder="Ip address"

+></MaskedTextBoxComponent>

Documented API: mask

ResultRendered in your app

AI coding assistantMCP Server · Syncfusion React

Use a hash as the prompt character for the card number.

search_docs“React Input Mask prompt characters” · 2 doc sections

Excerpt: imports and sample data omitted.

+<MaskedTextBoxComponent

+ mask="0000 0000 0000 0000"

+ promptChar="#"

+ placeholder="Card number"

+ floatLabelType="Always"

+/>

Documented API: promptChar

ResultRendered in your app

AI coding assistantMCP Server · Syncfusion React

Save the raw phone number and show the masked one.

search_docs“React Input Mask raw and masked values” · 2 doc sections

Excerpt: imports and sample data omitted.

+const mask = useRef(null);

+const [raw, setRaw] = useState('');

+const [shown, setShown] = useState('');

+<MaskedTextBoxComponent ref={mask} mask="(999)-999-9999"

+ placeholder="Formats"

+ floatLabelType="Always"

+ change={(e) => {

+ setRaw(e.value);

+ setShown(mask.current.getMaskedValue());

+ }} />

Documented API: value, change, getMaskedValue

ResultRendered in your app

AI coding assistantMCP Server · Syncfusion React

Add a user icon before the phone field and a send button after it.

search_docs“React Input Mask adornments” · 2 doc sections

Excerpt: imports and sample data omitted.

+const userIcon = () => ;

+const sendButton = () => ;

+<MaskedTextBoxComponent mask="000-000-0000"

+ placeholder="Phone number"

+ floatLabelType="Always"

+ prependTemplate={userIcon}

+ appendTemplate={sendButton} />

Documented API: prependTemplate, appendTemplate

ResultRendered in your app

AI coding assistantMCP Server · Syncfusion React

Make the product code uppercase, like AB-1234, whatever users type.

search_docs“React Input Mask uppercase and lowercase conversion” · 2 doc sections

Excerpt: imports and sample data omitted.

+<MaskedTextBoxComponent mask=">LL-0000"

+ placeholder="Product code"

+ floatLabelType="Always"

+/>

Documented API: mask, floatLabelType

ResultRendered in your app

AI coding assistantMCP Server · Syncfusion React

Show an error when the mobile number is not complete.

search_docs“React Input Mask form validation” · 2 doc sections

Excerpt: imports and sample data omitted.

+<form id="form-element">

+ <MaskedTextBoxComponent

+ id="mask"

+ name="mobile"

+ mask="(000) 000-0000"

+ placeholder="Mobile number"

+ floatLabelType="Auto"

+ ref={(scope) => {

+ this.maskObj = scope;

+ }}

+ blur={this.validatePhone}

+ />

+ <div id="validation-message"></div>

+</form>

Documented API: FormValidator, addRules

ResultRendered in your app

Features in depth

React Input Mask features in depth

Open a demo to try each one, or the docs to see the API.

Standard mask elements

Combine elements such as 0 for a digit, L for a letter, and A for a letter or digit, plus case shifts and escapes, to form any fixed format.

Number, string, and date masks

Build number masks for phone and card numbers, uppercase string masks for country codes and product keys, and date masks for culture-specific dates.

Custom characters and regular expressions

Turn any literal into a mask element with customCharacters, or wrap a regular expression in square brackets to validate one position, such as each digit of an IP address.

Prompt characters and floating labels

The promptChar property sets the symbol that marks each input position, an underscore by default. Floating labels and a clear button work as in the TextBox.

Form support and validation

Forms submit the raw value without literals, and getMaskedValue returns the formatted text. Add custom rules, such as a mobile number check, with the FormValidator.

Adornments: icons and action buttons

Place icons, country codes, or submit and copy buttons before and after the mask with prependTemplate and appendTemplate. They do not change how the mask works.

Numeric keypad and cursor position on mobile

Set type to tel so phones open a numeric keypad for number-only masks. The focus event can place the cursor at the start, the end, or any position.

Get started

Get your first input mask running, with or without AI

With an AI coding assistant

  1. Connect the Syncfusion MCP serverWorks in VS Code, Cursor, JetBrains, and other MCP-compatible assistants.Set up the MCP server
  2. Add Agent Skills to your projectYour agent follows Syncfusion’s recommended Input Mask patterns.Install Agent Skills
  3. Describe the input maskCopy this prompt to start.

    Add Syncfusion React Input Mask fields to my checkout for phone number, card number, and expiry date, with floating labels.

By hand, in three steps

1 · Install

npm install @syncfusion/ej2-react-inputs @syncfusion/ej2-tailwind3-theme --save

2 · src/App.css

@import '../node_modules/@syncfusion/ej2-tailwind3-theme/styles/maskedtextbox/index.css';

3 · src/App.tsx

import { MaskedTextBoxComponent } from '@syncfusion/ej2-react-inputs';
import './App.css';

export default function App() {
  return (
    <MaskedTextBoxComponent mask="(999) 999-9999" placeholder="Phone number" floatLabelType="Auto" />
  );
}
Read the getting started guide

Works withReact 15.5.4 or laterTypeScript and JavaScriptNext.jsRemixGatsbyVitePreactSystem requirements

Customer reviews

Trusted by developers and teams

G2

4.5/5

From 850+ reviews of Essential Studio®

Read the reviews on G2

“Awesome, enough said”

Easy usability, solving real-life problems, easy to implement. Most of the cases have the operators and settings possibilities you need right away.

Oliver O.Creative and Art Direction, Small Business

“A giant framework with great pricing options”

I have loved the components and options that Syncfusion has; besides, its documentation, demos, and support are excellent.

Alejandro Javier V.CEO, Small Business
75%
lower costs
50%
faster development

Customer story · Igniatek

Igniatek cuts development time 50% and costs 75% with Essential Studio®

“I would definitely recommend Syncfusion for anyone who is trying to develop something meaningful.”

Somnath Maji, Founder, Igniatek Consultancy

Award-winning

Including the 2026 Devies Award, Capterra Shortlist 2026, Software Advice FrontRunners 2026, and G2 Best Software 2025.

Syncfusion awards: 2026 Devies Award Winner, Capterra Shortlist 2026, Software Advice FrontRunners 2026, SaaS Awards 2026 Finalist, Hosting Advice Developers' Choice, A.I. Awards 2025 Finalist, Visual Studio Magazine Readers' Choice 2025 Gold, G2 Best Software 2025, ComponentSource Top 10 Publisher 2025, and TrustRadius Tech Cares 2025

Complete feature list

Every input mask feature, included in the license

  • Every feature includedNo separate enterprise edition
  • Royalty-freeNo runtime or deployment fees
  • Weekly patchesPlus regular feature releases
  • Expert supportFrom Syncfusion engineers

Related input components:React TextBoxReact Numeric TextBoxReact OTP Input

Questions and answers

React Input Mask FAQ

What is the React Input Mask?

The Syncfusion React Input Mask is a masked text box that accepts input only in a set format, such as a phone number or date. It shows where each character goes. Explore the demo

When should I use the Input Mask instead of the Numeric TextBox?

Use the Input Mask for fixed patterns such as phone numbers, postal codes, and product keys. Use the Numeric TextBox for amounts users calculate with, such as prices and quantities. React Numeric TextBox

How do I add an input mask in React?

Install @syncfusion/ej2-react-inputs and the Tailwind 3 theme, import maskedtextbox/index.css, and render MaskedTextBoxComponent with a mask such as 000-000-0000. Read the getting started guide

Which characters can a mask use?

Standard elements include 0 for a digit, 9 for a digit or space, L for a letter, and A for a letter or digit. Other characters appear as literals. See the mask elements

Can I define my own mask characters?

Yes. Map any literal to the values it accepts with customCharacters, such as P accepting A or P in a time mask. Custom mask demo

Can a mask use regular expressions?

Yes. Wrap a regular expression in square brackets, such as [0-2], to validate a single position. This suits IP addresses and other user-specific data. Read about regular expressions

How do I change the prompt character?

Set promptChar to the symbol that marks empty positions, such as # or *. The default is an underscore. Read about prompt characters

Does the form get the raw value or the masked value?

Forms submit the raw value without literals, and the value property returns it. Call getMaskedValue for the text with the mask applied. Formats demo

Can I show a numeric keypad on phones?

Yes. Set type to tel so mobile devices open a numeric keypad for number masks such as phone numbers. Read how to show the numeric keypad

Is the React Input Mask accessible?

Yes. It meets WCAG 2.2 and Section 508, uses the WAI-ARIA textbox role, and supports screen readers, keyboard input, and right-to-left layouts. Read about accessibility

Can AI coding assistants build with the React Input Mask?

Yes. The Syncfusion MCP server and Agent Skills give assistants in VS Code, Cursor, and JetBrains the current Input Mask docs and recommended patterns. You need a Syncfusion API key and an active license, which can be a commercial, Community, or trial license. Set up the MCP server

Is the Syncfusion React Input Mask free?

It is a commercial component with a 30-day free trial. A free Community License is available for companies and individuals with less than $1 million USD in annual gross revenue, five or fewer developers, and 10 or fewer total employees. Check Community License eligibility

Syncfusion React Input Mask

Build your React masked inputs faster with AI

The full Input Mask, the MCP server, and Agent Skills, free for 30 days.

  • No credit card required
  • Free Community License for eligible teams
  • No runtime or deployment fees