Skip to content

Commit

Permalink
Add inline styling to props (#648)
Browse files Browse the repository at this point in the history
As proposed in #611
  • Loading branch information
troibe authored Mar 19, 2021
1 parent bd8c216 commit 30e4844
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Miso/Html/Property.hs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ module Miso.Html.Property
, scoped_
-- * Data
, data_
, styleInline_
) where

import Miso.Html.Internal
Expand Down Expand Up @@ -398,3 +399,10 @@ class_ = textProp "class"
-- https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*
data_ :: MisoString -> MisoString -> Attribute action
data_ k v = textProp ("data-" <> k) v
-- | Set "style" property
--
-- > view m = div_ [ styleInline_ "background-color:red;color:blue;" ] [ "foo" ]
--
-- https://developer.mozilla.org/en-US/docs/Web/CSS
styleInline_ :: MisoString -> Attribute action
styleInline_ = textProp "style"

0 comments on commit 30e4844

Please sign in to comment.