on develop help sign in
Add input widgets.
00434d7Dan Brown
Quickref.md+23−1
@@ -224,9 +224,31 @@ Widgets may return any type (this is 'a' in many of the functions below). Often
224[W] blank :: m ()
224[W] blank :: m ()
225```
225```
226
226
227+#### Input widgets
228+
229+(These could be implemented entirely using the functions above.)
230+
231+These widget builders take a configuration record and return a record containing Events or other useful data associated with the created widget (similar to 'El'). The configuration records have default values, so you can just supply 'def'. See Reflex/Dom/Widget/Input.hs for record fields (Lenses are provided).
232+
233+look into preventDefault
234+
235+```haskell
236+-- Text input.
237+[W] textInput :: TextInputConfig -> m TextInput
238+[ ] textInputGetEnter :: TextInput -> Event ()
239+[W] textArea :: TextAreaConfig -> m TextArea
240+
241+-- Checkbox. The Bool supplies the initial state.
242+[W] checkbox :: Bool -> CheckboxConfig -> m Checkbox
243+
244+-- Dropdown with Dynamic options. First argument is initial state.
245+[W] dropdown :: (Ord k, Show k, Read k) =>
246+ k -> Dynamic (Map k String) -> DropdownConfig k -> m (Dropdown k)
247+```
248+
227#### Dynamic widgets
249#### Dynamic widgets
228
250
229−In the Dynamic cases above, the *content* of a widget is dynamic but the *definition* of the widget is static. The functions below enable the definition and/or structure of the widget itself to change over time.
251+In the Dynamic cases so far, the *content* of a widget is dynamic but the *definition* of the widget is static. The functions below enable the definition and/or structure of the widget itself to change over time.
230
252
231Note the "list" functions do not imply particular HTML tags (ul, li, etc), though the widgets they create can have those tags if you construct them appropriately.
253Note the "list" functions do not imply particular HTML tags (ul, li, etc), though the widgets they create can have those tags if you construct them appropriately.
232
254