gravity-ui / rfc

Gravity RFC is a process for proposing and implementing changes in our ecosystem
MIT License
3 stars 0 forks source link

Add native input validation to TextInput #5

Closed DaniilDem closed 5 months ago

DaniilDem commented 5 months ago

Objective

Sometimes it is necessary to validate the input for the TextInput using the pattern or attributes for type=number such as step, min, max

Solution Proposal

There are two options:

  1. Add a limited number of attributes to TextInput, such as pattern, step, min, and max
  2. Add extra properties to Text Input.

Definition of done

In TextInput, you can use browser-side validation/parsing As example: <TextInput type="number" pattern="\d{4,4}" step="" step="2" min="0" max="9999" />

SeqviriouM commented 5 months ago

@amje @korvin89 what do you think?

korvin89 commented 5 months ago

@DaniilDem @SeqviriouM Hi! There is no need to add this properties. You already can do this via controlProps