@dojo/widgets/constrained-input

June 25, 2020 ยท View on GitHub

Dojo's ConstrainedInput component creates a text input that follows certain pre-defined validation constraints. This can be used to quickly create an input that meets certain minimum standards like a username or password input.

Features

  • Handles validation state / messaging internally so the consumer does not have to
  • Easily validates against a set of predefined rules

Validation Rules

A number of validation options exist for validating common username / password scenarios.

PropertyDescription
length.minThe input value must be at least min characters long.
length.maxThe input value cannot be longer than max characters.
contains.uppercaseThe input value must contain at least uppercase number of uppercase characters.
contains.numbersThe input value must contain at least numbers number of numeric characters.
contains.specialCharactersThe input value must contain at least specialCharacters number of special characters.
contains.atLeastThe input value must match atLeast number of the uppercase, numbers, and specialCharacters rules.