Reflex Dom ========== See `Quick Ref `_ .. Type Classes .. ------------ .. A reference for what the type class is for .. DomBuilder .. ~~~~~~~~~~ Basic Widgets ------------- Static DOM ~~~~~~~~~~ Here is a simple example of using some of the static-dom widgets:: -- simple_dom.hs {-# LANGUAGE OverloadedStrings #-} import Reflex.Dom -- Code to showcase Reflex.Dom's APIs to create simple static DOM main = mainWidget $ do simple simple :: (DomBuilder t m) => m () simple = do el "div" $ -- Specify attributes in a (Map Text Text) elAttr "span" ("style" =: "color:blue") $ text "Text inside span" -- Use CSS style center-align and red-text -- using these specialised APIs divClass "center-align" $ elClass "span" "red-text" $ text "Div with class center-align and red text" el "dl" $ do dtdd "dt dd tags" $ text "Here goes the description" dtdd "Reflex" $ do text "Haskell + awesome FRP!" el "br" $ blank -- Add line break, blank == return () -- A simple URL link elAttr "a" ("href" =: "http://reflexfrp.org") (text "Reflex-FRP") Dynamic DOM ~~~~~~~~~~~ To create interactive widgets you need to do changes in DOM in response to ``Event``\s or ``Dynamic`` values. The simplest way to create a dynamic DOM is to use library APIs which take Dynamic values as input. The following section covers these APIs. Using these APIs you can create bigger widgets which can have multiple Dynamic values as input.:: -- Show simple text dynText $ someDynTextValue -- :: Dynamic t Text display $ someDynValueWithShowInstance -- The value of input element can be modified from an external Event t text txtInpEl <- inputElement $ def & inputElementConfig_setValue .~ changeValueEv Also you can create dynamic widgets by using static widgets, ie the widget which don't take dynamic values as inputs (eg. ``button :: Text -> m (Event t a)``). This can be done simply by mapping the Dynamic values over these widgets and using ``dyn``.:: -- Use the library API button which accepts static Text -- and modify its value by using a (Dynamic t Text) dyn (button <$> (value txtInpEl)) The library provides a number of standard widgets which accept ``Dynamic`` values as input ``elDynAttr elDynClass`` Change the attributes of a DOM element via Dynamic values. ``tableDynAttr`` A widget to display a table with static columns and dynamic rows.:: ``tabDisplay`` A widget to construct a tabbed view that shows only one of its child widgets at a time. Creates a header bar containing a ``