user11284257
user11284257

Reputation:

How to pass props to the inputComponent material-ui?

There is an example of Formatted inputs from material-ui docs https://stackblitz.com/edit/mfj4la

How to pass mask value [/\d/, /\d/, /\d/, /\d/, /\d/, /\d/, /\d/, /\d/] to the TextMaskCustom component from parent component?

Upvotes: 10

Views: 9572

Answers (1)

user11284257
user11284257

Reputation:

Custom props can be passed to the TextMaskCustom using inputProps

    <FormControl>
      <InputLabel>react-text-mask</InputLabel>
      <Input
        value={textmask}
        onChange={this.handleChange('textmask')}
        inputComponent={TextMaskCustom}
        inputProps={{
          mask:  [/\d/, /\d/, /\d/, /\d/, /\d/, /\d/, /\d/, /\d/]
        }}
      />
    </FormControl>

Upvotes: 20

Related Questions