georgesboris/elm-theme/1.0.0

NOTE: the latest version is 1.0.2

W.Theme.Sizing

Spacing sizes are used for sizing elements. This value is most commonly used for setting an element's max-width style.

Defined in rem units.

type alias SizingScale =
{ xs : Float
, sm : Float
, md : Float
, lg : Float
, xl : Float
, xl2 : Float
, xl3 : Float
}

Sizing

Use Sizing as an opaque type when creating a component that receives it as an argument. That way you can make sure conflicting tokens like radiuses or spacings are not being used in the wrong place:

W.Box.view
    [ W.Box.maxWidth W.Theme.Sizing.lg ]
    [ ... ]

The value can be transformed into a CSS value later:

Html.div
    [ W.Theme.styleList
        [ ( "max-width"
          , W.Theme.Radius.toCSS maxWidthValue
          )
        ]
    ]
type Sizing
custom : Float -> Sizing

A custom value using rem as unit.

Although discouraged in a design system, it is useful to provide visibility for custom values. That way you can quickly search for edge cases where your team is using values outside your default scale.

toCSS : Sizing -> String