mikesol / purescript-deku

A PureScript web UI framework
https://deku-documentation.vercel.app/
Apache License 2.0
135 stars 12 forks source link

How to deal with binary attributes? #89

Closed toastal closed 1 year ago

toastal commented 1 year ago

With a property like <input disabled> what is the most ergonomic way to handle disabled? All of the examples show little if _ thens, but I'm curious about when you need to completely remove the attribute. I know you could concat lists, but surely there's an Alt.do-compatible option? Something with guard?? And what is on the value side, D.Disable !:= null?

toastal commented 1 year ago

I tried

Alt.do
   isDisabled <#> \d → guard d $> D.Disabled !:= "disabled"

No luck.

mikesol commented 1 year ago

To unset an attribute, you can set it to unit. For more info, you can check out Unsetting an attribute with a hook in the Deku documentation.