miso
Copyright(C) 2016-2025 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Style

Description

 
Synopsis

Types

Smart Constructor

style_ :: [Style] -> Attribute action Source #

style_ is an attribute that will set the style attribute of the associated DOM node to attrs.

style attributes not contained in attrs will be deleted.

import qualified Data.Map as M
div_ [ style_ [ backgroundColor "red" ] [ ]

https://developer.mozilla.org/en-US/docs/Web/CSS

styleInline_ :: MisoString -> Attribute action Source #

Set "style" property

view m = div_ [ styleInline_ "background-color:red;color:blue;" ] [ "foo" ]

https://developer.mozilla.org/en-US/docs/Web/CSS

selector_ :: MisoString -> [Style] -> Styles Source #

Used when constructing a StyleSheet

sheet_
  [ selector_ ".name"
    [ backgroundColor red
    , alignContent "top"
    ]
  ]

(=:) :: k -> v -> (k, v) Source #

Smart constructor for Attributes. This function is helpful when constructing Style.

Example shown below.

div_ [ style_  [ "background" =: "red" ] ] []

Render

Combinators

Colors

Units

Animation

keyframes_ :: MisoString -> [(MisoString, [Style])] -> Styles Source #

https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes

testKeyFrame :: Styles
testKeyFrame = keyframes "slide-in"
  [ "from" =:
      [ transform "translateX(0%)"
      ]
  , "to" =:
      [ transform "translateX(100%)"
      , backgroundColor red
      , backgroundSize "10px"
      , backgroundRepeat "true"
      ]
  , pct 10 =:
    [ "foo" =: "bar"
    ]
 ]

Media Queries

media_ :: MisoString -> [(MisoString, [Style])] -> Styles Source #

https://developer.mozilla.org/en-US/docs/Web/CSS/@media

media_ "screen and (min-width: 480px)"
  [ "header" =:
      [ height "auto"
      ]
  , "ul" =:
      [ display "block"
      ]
  ]