if:*
Just like on:* is the output channel for event actions,
so too is the if:* attribute the output channel for state actions.
All of the following, along with any future additions, are behaviorally identical and differ only in how their conditions are calculated.
if:loading¶
KEML has no special concept of a loading indicator, because it does not need
one — loading is just another state condition.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
This endpoint takes 2 seconds to respond.
if:error¶
The error condition becomes true when the server returns an unsuccessful
status code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
if:invalid¶
The invalid condition becomes true when the element's value is invalid.
For custom elements (e.g. Web Components) to participate, they must implement
the standard
checkValidity
method and notify the system of their value changes by emitting one or more of
the following event types: change, input, reset.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
if:value¶
The value condition becomes true when the element's value is truthy.
Custom elements (like Web Components) can participate if they follow the same input-like behavior as native input elements:
- They must expose a
typeproperty. - They may expose additional input-like properties depending on
type:checked,files,src, andvalue. - When their value changes, they notify the system using one or more of these
events:
input,change,reset.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
if:intersects¶
The intersects condition becomes true when the element enters the viewport.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
Scroll the container down to reveal the green div, and watch this
paragraph turn green as well.