Danny Ellis Jr.
Danny Ellis Jr.

Reputation: 1706

Elm place open text inside HTML attribute

I have been desperately looking for a css framework to work well with ELM. I found one called UIKit, https://getuikit.com/docs/, that claims to watch the DOM and automatically initialize, etc. However, I noticed that inside the html tags, there is text like uk-close shown here. Is there a way to render this in Elm? The text function does not work because it returns the wrong type.

<button type="button" uk-close></button>

<a href="" uk-close></a>

Aside from that, does anyone know of a framework that works smoothly with Elm?

Upvotes: 0

Views: 142

Answers (2)

rlefevre
rlefevre

Reputation: 174

Aside from that, does anyone know of a framework that works smoothly with Elm?

All "CSS only" frameworks (not relying on javascript) work well with Elm.

Currently, there are already three of them that have packages supported with the last Elm 0.19 release if you want to benefit from strong typing:

CSS only frameworks can also be used without any package by using the CSS classes they define with Html.Attributes.class.

Upvotes: 0

Simon H
Simon H

Reputation: 21005

Adding an named property/attribute is possible - see http://package.elm-lang.org/packages/elm-lang/html/2.0.0/Html-Attributes#attribute and http://package.elm-lang.org/packages/elm-lang/html/2.0.0/Html-Attributes#property

But the real challenge you face is that the fancy effects you want will involve manipulating the DOM. If you mutate anything that Elm thought it was managing, you will end up with a mess. There is no easy way out of this, but Html.Keyed will give you some capacity to control Elm's dom diffing/rendering

Upvotes: 2

Related Questions