Skip to content

Instantly share code, notes, and snippets.

@mightybyte
Created June 14, 2016 05:05
Show Gist options
  • Save mightybyte/f2c1d0c2f5f1e8f07a0a90ff9f985e9a to your computer and use it in GitHub Desktop.
Save mightybyte/f2c1d0c2f5f1e8f07a0a90ff9f985e9a to your computer and use it in GitHub Desktop.
DynamicList Demo
-- Paste this into http://hsnippet.com after adding Reflex.Dom.Contrib.Widgets.DynamicList
-- to the imports list in HSnippet's imports tab.
app :: MonadWidget t m => App t m ()
app = do
addItem <- button "Add Item"
dynamicList single snd (const never) ("edit me" <$ addItem)
["alpha", "bravo", "charlie"]
return ()
single k v ups = do
el "div" $ do
del <- button "remove"
rec val <- holdDyn v $ leftmost [ups, edits]
edits <- editInPlace (constant True) val
return (edits, del)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment