Open staeter opened 2 years ago
You can already do something like this:
withAttributes :
List (Element.Attribute msg)
-> (List (Element.Attribute msg) -> a)
-> (List (Element.Attribute msg) -> a)
withAttributes attributes constructor =
\newAttributes ->
constructor (newAttributes ++ attributes)
and then
redButton =
Input.button |> withAttributes [ Background.color (Element.rgb 1 0 0) ]
redBorderedButton =
redButton
|> withAttributes
[ Border.width 1
, Border.color (Element.rgb 1 0 0)
]
I find myself wanting to add attributes to an element I've initiated in an other function quite often.
It would be useful whenever you want to overwrite some attributes
Also when you want to move it around without encapsulating it and adding a parent in between