useMask

Format the value of an input with a mask, such as a phone number or a date.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

# is a digit, A is a letter and * is any of them.

APIs

useMask

const useMask = (options: {
  mask: string
  initialValue?: string
}) => [
  string,
  (value: string | ChangeEvent<HTMLInputElement>) => void,
]
Edit this page on GitHub