Rerouted (cache, verified). The original is gone. This copy comes from a Lamdera package cache made before it went. The Lamdera package server serves a copy recovered from a Lamdera package cache from 2021-02-13.
What we checked: Rebuilt from the unpacked sources in a Lamdera package cache (5 copies agree), which Elm only writes after the published SHA-1 checked out; elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip is our own, so its SHA-1 is not the published one.
The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.
Details · package.elm-lang.org's zip: https://github.com/altayaydemir/style-elements/zipball/1.0.0/
Here is where you an create your style sheet.
One of the first concepts of style-elements is that layout, position, and width/height all live in your view through the Element module.
Your style sheet handles everything else!
Check out the other Style modules for other properties.
Check out Basic.elm in the examples folder to see an example of a full style sheet.
style-elements does away with CSS selectors entirely. Every style gets one identifier, which is ultimately rendered as a class.
Here's a basic example of a style that sets a few colors.
import Style exposing (..)
import Style.Color as Color
import Color exposing (..)
type Styles
= Button
stylesheet =
Style.styleSheet
[ style Button
[ Color.background blue
, Color.text white
]
]
-- Which can be used in your view as:
el Button [ ] (text "A button!")Styles can have variations. Here's what it looks like to have a button style with a variation for Disabled
import Style exposing (..)
import Style.Color as Color
import Color exposing (..)
type Styles = Button
-- You need to create a new type to capture variations.
type Variations
= Disabled
stylesheet =
Style.styleSheet
[ style Button
[ Color.background blue
, Color.text white
, variation Disabled
[ Color.background grey
]
]
]
-- which can be rendered in your view as
el Button [ vary Disabled True ] (text "A Disabled button!")Before you reach for a variation, consider just creating a subtype. So, something like:
import Style exposing (..)
import Style.Color as Color
import Color exposing (..)
type Styles
= Button ButtonStyles
type ButtonStyles
= Active
| Disabled
stylesheet =
Style.stylesheet
[ style (Button Active)
[ Color.background blue
]
, style (Button Disabled)
[ Color.background grey
]
]
-- which can be rendered in your view as
el (Button Active) [] (text "An Active button!")The main difference between these two is that variations can combine with other variations, while subtypes are mutually exclusive.
Takes values from 0 to 1 to make a nontransparent color in the rgb space.
Takes values from 0 to 1 to make a transparent color in the rgb space.
Set the transform origin.
Units are always as pixels
Units always rendered as radians.
Use degrees or turns from the standard library if you want to use a different set of units.
Rotate around a vector.
Angle units always rendered as radians.
Use degrees or turns from the standard library if you want to use a different set of units.
Psuedo classes can be nested.
Example:
style Button
[ Color.background blue
, hover
[ Color.background red
]
]Stylesheet options