Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- width :: PxRem -> Mod
- height :: PxRem -> Mod
- minWidth :: PxRem -> Mod
- minHeight :: PxRem -> Mod
- pad :: Sides PxRem -> Mod
- gap :: PxRem -> Mod
- fontSize :: PxRem -> Mod
- flexRow :: Mod
- flexCol :: Mod
- shadow :: Mod
- rounded :: PxRem -> Mod
- bg :: ToColor c => c -> Mod
- color :: ToColor c => c -> Mod
- bold :: Mod
- hide :: Mod
- border :: Sides PxRem -> Mod
- borderColor :: ToColor c => c -> Mod
- pointer :: Mod
- truncate :: Mod
- transition :: Ms -> TransitionProperty -> Mod
- data TransitionProperty
- textAlign :: Align -> Mod
- data Align = Center
- hover :: Mod -> Mod
- active :: Mod -> Mod
- even :: Mod -> Mod
- odd :: Mod -> Mod
- media :: Media -> Mod -> Mod
- parent :: Text -> Mod -> Mod
- applyPseudo :: Pseudo -> Mod -> Mod
- mapModClass :: (Class -> Class) -> Mod -> Mod
- addClass :: Class -> Mod
- cls :: ClassName -> Class
- prop :: ToStyleValue val => Name -> val -> Class -> Class
- (-.) :: ToClassName a => ClassName -> a -> ClassName
Styles
minWidth :: PxRem -> Mod Source #
Allow width to grow to contents but not shrink any smaller than value
minHeight :: PxRem -> Mod Source #
Allow height to grow to contents but not shrink any smaller than value
pad :: Sides PxRem -> Mod Source #
Space surrounding the children of the element
To create even spacing around and between all elements:
col (pad 10 . gap 10) $ do el_ "one" el_ "two" el_ "three"
border :: Sides PxRem -> Mod Source #
Set a border around the element
el (border 1) "all sides" el (border (X 1)) "only left and right"
Use a button-like cursor when hovering over the element
Button-like elements:
btn = pointer . bg Primary . hover (bg PrimaryLight) options = row id $ do el btn "Login" el btn "Sign Up"
transition :: Ms -> TransitionProperty -> Mod Source #
Animate changes to the given property
el (transition 100 (Height 400)) "Tall" el (transition 100 (Height 100)) "Small"
data TransitionProperty Source #
Instances
Show TransitionProperty Source # | |
Defined in Web.View.Style showsPrec :: Int -> TransitionProperty -> ShowS # show :: TransitionProperty -> String # showList :: [TransitionProperty] -> ShowS # |
Instances
Show Align Source # | |
ToClassName Align Source # | |
Defined in Web.View.Style toClassName :: Align -> Text Source # | |
ToStyleValue Align Source # | |
Defined in Web.View.Style toStyleValue :: Align -> StyleValue Source # |
Selector Modifiers
Apply when hovering over an element
el (bg Primary . hover (bg PrimaryLight)) "Hover"
media :: Media -> Mod -> Mod Source #
Apply when the Media matches the current window. This allows for responsive designs
el (width 100 . media (MinWidth 800) (width 400)) "Big if window > 800"
parent :: Text -> Mod -> Mod Source #
Apply when the element is somewhere inside an anscestor.
For example, the HTMX library applies an "htmx-request" class to the body when a request is pending. We can use this to create a loading indicator
el (pad 10) $ do el (parent "htmx-request" flexRow . hide) "Loading..." el (parent "htmx-request" hide . flexRow) "Normal Content"