formaat-design / reshaped

Community repository for storing examples, reporting issues and tracking roadmap
https://reshaped.so
109 stars 3 forks source link

Number Input #281

Open xgatic opened 1 month ago

xgatic commented 1 month ago

A number input would be great to support admin interfaces handling lot of data and numbers. Basically the same as a text input, just with arrows on the right side additionally (keyboard support, etc.)

Bildschirmfoto 2024-07-31 um 14 34 55
chrismcv commented 3 weeks ago

I've forked TextField for this reason. My solution was to add an inputComponent prop that could accept a custom factory to create the control.

    return (
        <div {...attributes} data-rs-aligner-target className={rootClassName}>
            <TextFieldSlot position="start" icon={icon} slot={startSlot} size={size} affix={prefix} />
            {inputComponent ? (
                React.createElement(inputComponent as any, inputProps)
            ) : (
                <input {...inputProps} />
            )}

            <TextFieldSlot position="end" icon={endIcon} slot={endSlot} size={size} affix={suffix} />
        </div>
    );