Masks That Switch By Length
Masks for documents, codes and phones, with several masks in one field chosen by the length typed, like CPF and CNPJ.
NWD Text Input (Text/Email/URL) was built to replace the text formats of Bubble’s native input, from plain text and numbers-only text to email, and adds the URL it has no format for, offering far more styling flexibility and control. It brings input masks, text normalization, hidden characters for documents, email and URL validation, and typo suggestions together in one polished component. Fully customizable through 40+ properties, giving you complete control over every visual and behavioral detail.
Built for what Bubble does not cover.
Bubble's native text field is one type of a generic input that also does numbers, passwords, phones and others. It has formats for plain text, digits only and email, but no URL, no input mask, no way to clean what is typed, and no way to hide a document number once it is filled in. Masks and clean-up end up as workflows that run after the fact, and the person sees the raw text until they do.
Masks for documents, codes and phones, with several masks in one field chosen by the length typed, like CPF and CNPJ.
Email and URL checked as they are typed, with allowed and blocked domain lists and a pattern of your own.
A clickable "Did you mean" when the email domain looks like a typo, such as gmial.com or .con.
Remove accents, numbers and special characters, collapse spaces and fix the case, while typing or only in a state.
Show a document number as •••-••-1234 when the field is not focused, keeping the first or the last characters.
Fully operable from the keyboard and announced to screen readers, including the email suggestion.
In detail
Place the plugin element wherever you need it.
Adjust the settings to match your use case, including the content format, the mask, the normalization, and the validation rules.
Use the value changed event to capture the confirmed text and read the exposed states to use them anywhere in your app.
The text is published in several shapes at once, and they are not interchangeable. Store value (normalized) or value (unmasked) when you need the clean version; show value (display) wherever the hidden characters should stay hidden.
Text displayed in the input while it has no value.
Color of the placeholder text.
Validation applied to the text. Numbers accepts digits only; email and url check the format; each one adjusts the mobile keyboard.
Each format also sets the mobile keyboard: numbers opens the numeric pad, email adds the @ key and url adds the slash and .com keys.
Case transformation applied while typing. Capitalize raises the first letter of each word; name case also lowers the rest and raises letters after hyphens and apostrophes (ahmed el-maghrebi > Ahmed El-Maghrebi). Email always uses lowercase.
Name case lowers the rest of each word and raises the letter after a hyphen or an apostrophe, so `o'connor` becomes `O'Connor` and `el-maghrebi` becomes `El-Maghrebi`.
Whether the browser can suggest saved values.
Maximum number of characters, counting the fixed characters of the mask. It also trims the default value and the Set value text, and applies right away when it changes. Use 0 for no limit.
Shows the typed and maximum characters (12/100) inside the input.
Font color of the character counter.
Shows an icon that clears the input while it has a value.
Icon used to clear the input.
Color of the clear icon.
Controls whether the input icon is displayed.
Icon displayed in the input.
Icon size in pixels. When empty, it is calculated from the input font size.
Color of the input icon.
Whether the icon appears to the left or right of the input text.
Replaces accented letters with the plain letter (José > Jose, ç > c).
Removes digits from the text.
Removes characters that are not letters, digits or spaces, except the allowed ones.
Special characters kept when special characters are removed, typed together (for example -'.).
Turns repeated spaces into one and removes spaces at the start; spaces at the end are removed when leaving the input.
Shows the normalized text in the input while typing. When off, the input keeps what was typed and the value (normalized) state holds the normalized text.
Off, the field keeps the text exactly as typed and only `value (normalized)` is cleaned. Useful when the person needs to see what they wrote, such as a name with accents, while your database gets the plain version.
9 = digit, A = letter, * = letter or digit; other characters are fixed. Separate masks with | to switch by length (999.999.999-99|99.999.999/9999-99). Empty for no mask.
`9` is a digit, `A` is a letter and `*` is either; other characters are fixed. With several masks separated by `|`, the field switches by the length typed.
Shows the first mask as the placeholder, with _ in place of each character (___.___.___-__).
Hides the letters and digits of the value while the input is not focused, like a document number (•••-••-1234). Fixed characters stay visible.
Only what is shown is hidden: `value` and `value (unmasked)` keep the full text, and `value (display)` holds the hidden version.
How many letters or digits stay visible.
Whether the visible characters are the last or the first ones.
Symbol shown in place of each hidden character.
Regular expression the value must match to be valid. Leave empty to skip.
Only these domains are valid. Leave empty to accept any domain.
One domain per line, pressing Enter between them. A domain covers its subdomains, so `company.com` also accepts `mail.company.com`.
These domains are always invalid.
Suggests the right domain when the typed one looks like a typo (gmail.con becomes gmail.com).
Text of the suggestion. {email} is replaced by the suggested address.
Font color of the suggestion.
Also triggers Value changed as the user types. Unchecked, it triggers only on leaving the input or on Enter, like Bubble's native input.
A search bound to this element's value already updates as the person types, without this option. Check it when the filter, autosave or counter runs through a workflow.
Value applied on load and on reset.
Disables the component, preventing any interaction.
Input background color when disabled.
Input border color when disabled.
Input font color when disabled.
Marks the field as required and enables input validation.
Input background color when invalid.
Input border color when invalid.
Input background color when focused.
Input border color when focused.
Name read by screen readers. When empty, uses the placeholder or the visible label.
Hint read by screen readers after the name. Empty for none.
Values the element exposes for the rest of the page to read.
An optional input can still be invalid: once there is text, it has to fit the mask, the content format, the validation pattern and the email domain lists.
Every state updates on each keystroke, so texts, conditions and searches bound to it react as the person types, with no workflow and without waiting for the field to lose focus. For a database search over a large list, consider feeding it from the value changed event instead, so the search runs once per pause or on confirming rather than on every keystroke.
Current text.
Number of characters typed.
Suggested email when the domain looks like a typo. Empty otherwise.
Text after the normalization options (accents, numbers, special characters, spaces).
Characters removed by the normalization since the input was last cleared or reset.
Value without the fixed characters of the mask (123.456.789-09 > 12345678909). Same as value without a mask.
Value as shown when not focused, with the hidden characters replaced (•••-••-1234). Same as value when hiding is off.
True when the component is not disabled.
True when the input is marked as required.
True when the value is accepted. False when it is required and empty, or the value does not fit the mask, the content format (numbers, email, url), the validation pattern, or the allowed and blocked email domains. It updates on every change, so a workflow can rely on it; the invalid style only shows after the person leaves the field, or when a workflow sets the value.
True while the input has focus.
Where a workflow can start.
Triggered when the text is confirmed with a different value: leaving the input, pressing Enter, typing when Trigger value changed while typing is checked, clearing or resetting, or when a change to the case, format, mask or character limit adjusts a text that was already typed or set.
What a workflow can tell the element to do.
Restores the default value, or clears the input when there is none.
Focuses the text input.
Writes a value into the field from a workflow and refreshes the exposed states.
Yes applies the value even while the element is disabled. No makes the action do nothing in that state.
The value to write into the field. It goes through the same treatment as a value typed by the user. An empty value clears the field.
Several states at once. `value` is the text in the field. `value (normalized)` is the text after the normalization options, even when the field shows what was typed. `value (unmasked)` drops the fixed characters of the mask (`123.456.789-09` becomes `12345678909`). `value (display)` is what the field shows when it is not focused, with the hidden characters in place. `value length` counts the characters, and `removed characters` lists what the normalization took out.
In a mask, `9` is a digit, `A` is a letter and `*` is either; anything else is fixed and typed for the person. Separate masks with `|` and the field picks one by the length typed, so `999.999.999-99|99.999.999/9999-99` takes a CPF and switches to a CNPJ when the person keeps typing. The value is only valid once a mask is complete.
The format, plus your own rules. Content format checks that an email has a name, an `@` and a domain with an extension, and that a URL has a domain with an extension, followed or not by a path. For email, Allowed domains accepts only the domains you list, subdomains included, and Blocked domains rejects the ones you list. Validation pattern adds a regular expression of your own for anything else.
The is valid state follows the value at every keystroke, so a workflow can rely on it to enable a button. The red style waits until the person leaves the field, so it never flags a value that is still being typed, and it also shows when a workflow sets a value that is not accepted. An empty field is invalid only when This input is required? is checked; text that does not fit the format, the mask or the pattern is invalid either way.
Yes. Turn off Normalize while typing? and the field keeps the text as typed, while `value (normalized)` holds the cleaned version for your database. Turned on, the field shows the cleaned text as it is typed.
Yes. The Set value action writes text from anywhere in your app, with control over whether it applies while the input is disabled; Reset returns the field to its default value; and Focus puts the cursor in it. The value changed event fires when the person confirms a new text, by leaving the field or pressing Enter, or, with Trigger value changed while typing? checked, as the person types, for filters that run through a workflow. It also fires when a change to the case, format, mask or character limit adjusts a text that was already typed or set.
This plugin is maintained by GCS Studios and is part of the NWD UI - Input family, form controls built from scratch for Bubble, inspired by a personal component library originally built for React. Each one is carefully designed and tested in real applications before release, for the level of control, polish and reliability that native Bubble inputs often do not provide. See more plugins on the GCS Studios contributor page.
Each control here is drawn by the plugin instead of being restyled from a native one, so they match each other across the library and keep the same shape in every browser.