We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I find myself wanting to add attributes to an element I've initiated in an other function quite often.
addAttributes : List (Element.Attribute msg) -> Element msg -> Element.msg
It would be useful whenever you want to overwrite some attributes
redButton = Element.Input.button [ Element.Background.color (Element.rgb 1 0 0) ] {...} blueButton = addAttributes [ Element.Background.color (Element.rgb 1 0 0) ] redButton
Also when you want to move it around without encapsulating it and adding a parent in between
movedButton topLeft = addAttributes [ Element.moveDown point.y, Element.moveRight point.x ] redButton
The text was updated successfully, but these errors were encountered:
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) ]
Sorry, something went wrong.
No branches or pull requests
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
The text was updated successfully, but these errors were encountered: