Migration from CSS TextBox to React TextBox
03 Sep 20261 minute to read
From v16.3.21 onwards, the React TextBox is available as a dedicated React component, enabling floating label functionality with significantly less code. For a complete list of properties, methods, and events, refer to the API reference.
The following table describes the migration from CSS TextBox to React TextBox component.
Normal TextBox
| Rendering mode | CSS TextBox | React TextBox component |
| ———————–| ———————————–| ——————————————- |
| Default rendering | <div class='e-input-group'><input class='e-input' type='text' placeholder='Enter Value'/></div> | <TextBoxComponent id="default" placeholder="Enter Value" floatLabelType="Never" /> |
| TextBox with clear button | <div class='e-input-group'><input class='e-input' placeholder='Enter Value' required='true'><span class='e-clear-icon'></span></div>
Note: You have to write action for clear button. | <TextBoxComponent id="clear-input" placeholder="Enter Value" showClearButton={true} floatLabelType="Never" /> |
| Validation states | <div class='e-input-group e-error'><input class='e-input' type='text' placeholder='Enter Value' /></div>
Note: TextBox component consists of three types of validation rules such as success, warning, and error. | <TextBoxComponent id="validation" placeholder="Enter Value" cssClass="e-error" floatLabelType="Never" /> |
Floating label TextBox
| Rendering mode | CSS TextBox | React TextBox component |
| ———————–| ———————————–| ——————————————- |
| Default rendering | <div class='e-float-input'><input type='text' required /><span class='e-float-line'></span><label class='e-float-text'>Enter Value</label></div> | <TextBoxComponent id="default" placeholder="Enter Value" floatLabelType="Auto" /> |
| TextBox with clear button | <div class='e-float-input e-input-group'><input type='text' required value= 'Clear Input' /><span class='e-float-line'></span><label class='e-float-text'>Enter Value</label><span class='e-clear-icon'></span></div>
Note: You have to write action for clear button. | <TextBoxComponent id="clear-input" placeholder="Enter Value" showClearButton={true} floatLabelType="Auto" /> |
| Validation states | <div class='e-float-input e-error'><input type='text' required /><span class='e-float-line'></span><label class='e-float-text'>Enter Value</label></div>
Note: TextBox component consists of three types of validation rules such as success, warning, and error. | <TextBoxComponent id="validation" placeholder="Enter Value" cssClass="e-error" floatLabelType="Auto" /> |