sightly

How to conditionally set input attribute as disabled (Adobe Sightly HTL)


Considering that the inputs can have disabled attributes, how one would set it up depending if the condition is true? :-)

Concept: <input ${condition ? disabled : ''} />


Solution

  • Since falsy attributes are removed in HTL/Sightly, you can write:

    <input disabled="${condition}" />
    

    See also https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#2231-detailed-examples