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.35k stars 111 forks source link

API improvement suggestion #365

Open chris-montero opened 1 week ago

chris-montero commented 1 week ago

Problem

Elm-ui 1.1.8 "el" elements can normally only contain one single child. The way to draw something "layered" with elm-ui is to use the Attribute by the name "inFront" or "behindContent".

Solution

Instead of this, let the "el" element have multiple children, just like the "row" and "column". And have the children of the "el" element just be rendered one on top of the other in the correct order.

This is the approach used in this project, which drew inspiration from elm-ui for its UI layout engine.

johndeighan commented 5 days ago

It's a good suggestion; unfortunately, it would break a lot of existing code. So, I would suggest just creating a new element, for example layers, which would accept multiple children and do what you suggest.

chris-montero commented 5 days ago

I'm mentioning this in the hopes it will make it in the 2.0 branch that is in the works.