Attributes

To allow binding state to HTML element attributes, a couple of helpers are provided.

x-attr

It’s possible to bind attributes with x-attr:

Editor

  

The idea is that x-attr tells Sidewind that there are bindings and then @ is used to signify which. Using the keyword is a small optimization and it also makes it easier to find spots in code where you might have attribute bindings in place.

Expressions

For classes, it’s possible to pass an array to evaluate to produce multiple classes based on expressions:

Editor

  

Attribute fallbacks

Default classes are retained as this allows more compact syntax with a fallback:

Editor

  
Link target

Element access

Attributes have access to the element itself through element:

Editor

  
Title should be foobar now

Note that this points to Window should you need it. The same functionality is available to all evaluations.