mdgriffith / elm-ui

What if you never had to write CSS again?
https://package.elm-lang.org/packages/mdgriffith/elm-ui/latest/
BSD 3-Clause "New" or "Revised" License
1.34k stars 110 forks source link

Add `Element.id : String -> Attribute msg` #319

Open pravdomil opened 3 years ago

pravdomil commented 3 years ago

Ids are nessesary for Browser.Dom things.

z5h commented 3 years ago

@pravdomil

From the docs:

This library is a complete alternative to HTML and CSS.

So the intention is to avoid using HTML/CSS. The fact that elm-ui is currently is implemented via HTML/CSS (and not WebGL for example) is an implementation detail, not a first-class feature. Therefore, there is no place for id in the API.

In any case, we can currently do:

id : String -> Element.Attribute msg
id =
    Html.Attributes.id >> Element.htmlAttribute