georgesboris/elm-theme/1.0.1

NOTE: the latest version is 1.0.2

W.Theme.Spacing

Spacing sizes are used for spacing elements, not sizing them. These values are mainly used for setting the gap, padding and margin styles.

Defined in rem units.

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

Spacing

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

W.Box.view
    [ W.Box.padding W.Theme.Spacing.sm ]
    [ ... ]

The value can be transformed into a CSS value later:

Html.div
    [ W.Theme.styleList
        [ ( "padding"
          , W.Theme.Spacing.toCSS paddingValue
          )
        ]
    ]
type Spacing
custom : Float -> Spacing

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 : Spacing -> String