# Options
There are two main components that you can customize: the `Mask` class and the `MaskInput` class. You typically work directly with the latter, but since `MaskInput` options extend `Mask` options, you can configure both using a single object.
## `Mask` options
To set options for a `Mask` class you can pass an object when creating the class:
```js
new Mask({ mask: "#-#", eager: true, number: { locale: 'de' }})
```
Options passed in this way will be used as default values and can be overridden by `data-maska-` attributes of a given input element.
### **Description**
| Option / data-attribute |
Default |
Description |
mask
data-maska |
— |
Mask to apply (string, array of strings or function). If you pass an empty string or null it will disable a mask |
tokens
data-maska-tokens |
— |
Custom tokens object. See tokens page |
tokensReplace
data-maska-tokens-replace |
false |
If custom tokens should replace default tokens (if not set, they will merge) |
eager
data-maska-eager |
false |
Eager mode will show static characters before you type them, e.g. when you type 1, eager mask #-# will show 1- and non-eager will show 1 |
reversed
data-maska-reversed |
false |
In reversed mode mask will grow backwards, e.g. for numbers |
number.locale
data-maska-number-locale |
en |
Locale for number mode. Determine the national format for the number |
number.fraction
data-maska-number-fraction |
0 |
Fraction digits for the number (0 allows only integer numbers) |
number.unsigned
data-maska-number-unsigned |
false |
Unsigned mode for the number: if you want to accept only positive numbers |
### **Types**
```typescript
interface MaskOptions {
mask?: MaskType
tokens?: MaskTokens
tokensReplace?: boolean
eager?: boolean
reversed?: boolean
number?: MaskNumber
}
type MaskType = string | string[] | ((input: string) => string) | null
interface MaskToken {
pattern: RegExp
multiple?: boolean
optional?: boolean
repeated?: boolean
transform?: (char: string) => string
}
type MaskTokens = Record