pmndrs / uikit

🎨 user interfaces for react-three-fiber
https://docs.pmnd.rs/uikit/
Other
2.5k stars 127 forks source link

Support number for input types #84

Open wrangelvid opened 1 month ago

wrangelvid commented 1 month ago

The input supports text and password as types, and there are many more that exist for the html input. We should consider supporting more of these types and start with a simple one like number.

bbohlender commented 1 month ago

number sounds reasonable, but we should think of a clean line to draw with a clear abstraction that shows what and what is not support for Input since I am very much against support things like a calendar for pmndrs/uikit core.

A possible abstraction could be a filter property which excepts a Regex | (text: string) => boolean. So type="number" implicitly sets the filter property to only filter numbers.

I would not support properties that change the appearance of the Input. This could also mean to rename Input to TextInput and building NumberInput and PasswordInput using TextInput to clarify that Input does not support type="date" etc. What do you think?

wrangelvid commented 1 month ago

I agree with you and think the explicit distinction through the name makes sense as long as we keep code reusability high.

TextInput, NumberInput, PasswordInput would be nice. Are there any other inputs you think are must haves?