justgage/tachyons-elm/2.1.1

NOTE: this package is not compatible with Elm 0.19.1

Tachyons

Tachyons is the best CSS framework ever. It's an implementation of what people call "Functional CSS" which makes working with CSS a little bit easier.

In functional CSS you have a ton of little CSS classes that do one thing, and do it well #unixphilosophy.

Essentially what this means is that can create almost any interface without writing custom css, you only need to compose different CSS selectors together. Here is an example:

div [classes [pa1, red, f1]] []

This will:

  • Add the smallest padding available on all four sides (Padding Around 1)
  • Make the foreground color red (an Accessible friendly version)
  • Make the font-size as big as an h1 tag.

There's even responsive versions. Like p1_ns that will only add padding to anything that is "not small" (larger than mobile). This style allows you to easily create responsive mobile interfaces.

Working example

To use the library, just put tachyons.css somewhere in your elm-html code to add the stylesheet to your document, and then you can do whatever you want! Here is a small example:

module Main exposing (..)


import Tachyons exposing (classes, tachyons)
import Tachyons.Classes exposing (f1, purple)
import Html exposing (..)




main =
    div [ classes [ f1, purple ] ]
        [ tachyons.css
        , text "I'm Purple and big!"
        ]

Helper Classes

classes : List String -> Attribute msg

This is a helper funciton that will allow you to combine multiple Tachyons classes (which are strings) are return a Html.Attributes

div [classes [pa3, red, f1]] []
stylesheet : String -> Html msg

An easy way to add stylesheets to a Html document

tachyons : { css : Html msg }

Tachyons 4.6.1

"Create fast loading, highly readable, and 100% responsive interfaces with as little css as possible." also is an implementation of functional CSS.