
009: elm-ui
We discuss the fundamentals of elm-ui, and how to decide if it's the right fit for your team.
Audio is streamed directly from the publisher (cdn.simplecast.com) as published in their RSS feed. Play Podcasts does not host this file. Rights-holders can request removal through the copyright & takedown page.
Show Notes
elm-uipackage- Fewer overlapping ways to express views
Element.padding(no concept of margin)
Previously called style-elements
There used to be a notion of a single type defining all possible styles
Latest
elm-uisimplifies that by using only inline styles. You build your own abstractions with vanilla Elm functions/modules etc.Elementtype is the equivalent of theHtmltype fromelm/html
Escape hatches
Element.htmlworks at leaf nodes, butelm-uiin general doesn’t mix with plain htmlElement.htmlAttributeRefactoring is a huge asset for a team, so much easier than css refactoring
Doesn’t expose all the css tricks directly, sometimes you need escape hatches to access those
Responsiveness
- Pass in window size from your Elm model
- Doesn’t use media queries, so that approach doesn't play well with with pre-rendered html like in
elm-pages classifyDeviceis an optional helper for responsiveness
Semantic html
- Express layout with
Element.row,column,el - Semantic HTML is independent from layout. Set with attributes using the
Element.Regionmodule.
Wrapping
Element.paragraphuses text wrapping
em/rem
elm-uidoesn't expose access toremandemunits to simplify the mental model and reduce overlapping ways to express something
Cookbooks/examples
Lucas Payr's elm-ui-widgets
Alex Korban's elm-ui patterns
)
Debugging elm-ui views
Element.explaingives you highlights around nested elements- Inspecting developer tools doesn't help much with
elm-ui, butelm-uiis much more traceable because it doesn't have layout cascading like CSS
Resources
- Matt's
elm-uiannouncement talk at Elm Europe (was aboutelm-style-elements, but still worth a watch) - Matt's more recent
elm-uiconference talk - Richard Feldman's talk CSS as Bytecode (uses style-elements, but it's a great intro tutorial on
elm-uiconcepts) - #elm-ui channel in the Elm slack