---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.3
alternate:
  - https://divkit.tech/docs/en/concepts/divs/2/div-fixed-length-input-mask.md
  - https://divkit.tech/docs/ru/concepts/divs/2/div-fixed-length-input-mask.md
---
> **Documentation Index:** Fetch the complete configuration index at https://divkit.tech/docs/en/llms.txt

# div-fixed-length-input-mask
Mask for entering text with a fixed number of characters.

## Parameters
| Parameters | Description |
| --- | --- |
| `pattern` | <p>**string**</p><p>Required parameter.</p><p>String that sets the text input template. For example, the `+7 (###) ###-##-## ` template for a phone number.</p><p>Available platforms: Android, iOS, web.</p> |
| `pattern_elements` | <p>**array**</p><p>Required parameter.</p><p>Template decoding is a description of the characters that will be replaced with user input.</p><p>An array must not be empty.</p><p>Available platforms: Android, iOS, web.</p> |
| `raw_text_variable` | <p>**string**</p><p>Required parameter.</p><p>Name of the variable to store the unprocessed value.</p><p>Available platforms: Android, iOS, web.</p> |
| `type` | <p>**string**</p><p>Required parameter.</p><p>The value must always be `fixed_length`.</p><p>Available platforms: Android, iOS, web.</p> |
| `always_visible` | <p>**bool_int**</p><p>If this option is enabled, the text field contains the mask before being filled in.</p><p>Default value: `false`.</p><p>Available platforms: Android, iOS, web.</p> |

### pattern_element
| Parameters | Description |
| --- | --- |
| `key` | <p>**string**</p><p>Required parameter.</p><p>A character in the template that will be replaced with a user-defined character.</p><p>A string must not be empty.</p> |
| `placeholder` | <p>**string**</p><p>The character that's displayed in the input field where the user is expected to enter text. This is used if mask display is enabled.</p><p>A string must not be empty.</p><p>Default value: `_`.</p> |
| `regex` | <p>**string**</p><p>Regular expression for validating character inputs. For example, when a mask is digit-only.</p> |

<details>
<summary>JSON</summary>

```json
{
  type*: "fixed_length",
  always_visible: "bool_int",
  pattern*: "string",
  pattern_elements*: [
    {
      key*: "string",
      placeholder: "string",
      regex: "string"
    },
    ...
  ],
  raw_text_variable*: "string"
}
```
</details>
