What is the advantage of using a <ui:inputText>
component instead of an <input type="Text">
?
In fact, the ui:
version seems more locked down, as currently methods like .focus()
seem to fail on it.
|
The advantage is styling and general ease of use. According to the documentation, you can use this code:
To generate all of this actual HTML:
Yes, you lose some feature parity opposed to writing pure HTML, but you gain automatic styling, including the related label, which means there's less code for you to remember and type. If you have a relatively big component with 20-30 fields, you've just eliminated 140+ lines of code, and you get to make them all consistent with a lot less effort. If you have a specific need to do something more than what the element allows, then yes, you'll have to resort to pure HTML, but in all other cases, you should prefer the As an added bonus, you can automatically bind to a component's attribute without having to write more complicated code, so you don't have to "find" the element, grab its value, and then assign it to the attribute or otherwise use it. |
|||||||||
|