Is it possible to set data-unit into the sp-textfield?


Is it possible to set the data-unit field (e.g. “px”) into the sp-textfield component like I already did in the Adobe React Spectrum?


I already tried with the sp-label by moving it down and right with negative margins but it gets clipped.

Thanks in advance,

Since we still don’t have the sp-number-field it would be great if the sp-textfield had the min, max, and step values. type='number' just isn’t enough if we are going to use this field for the numbers. I managed to make the custom steps on the WheelEvent and KeyboardEvent but I couldn’t limit the max and the min if the user types some numbers into the field. The limitation works only for the first time but if the user continues to type more numbers it just breaks.

Also, something like regex support to limit the input characters would be great as well. With that, we could limit the input just to the integers (excluding the dot character).

And as for the “data-unit” this is the part that could help if made available:

format-options='{"style": "percent"}'

I found that by reading the documentation of the Spectrum Web Components.
Here is the link: Number Field: Spectrum Web Components

@kerrishotts I know that a lot of people are pinging you but do you happen to know when the sp-textfield will get support for min, max, and step values and perhaps a data unit attribute?