File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -296,6 +296,19 @@ exports.cRadioGroup = function(xs) {
296296 } ;
297297} ;
298298
299+ exports . cTextarea = createComponent ( "textarea" ,
300+ function ( initial ) {
301+ var textarea = document . createElement ( "textarea" ) ;
302+ textarea . value = initial ;
303+ return textarea ;
304+ } ,
305+ "input" ,
306+ function ( t , initial ) {
307+ return t . value ;
308+ }
309+ ) ;
310+
311+
299312exports . toFieldset = function ( label ) {
300313 return function ( elements ) {
301314 var fieldset = document . createElement ( "fieldset" ) ;
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ module Flare
2929 , select_
3030 , radioGroup
3131 , radioGroup_
32+ , textarea
33+ , textarea_
3234 , color
3335 , color_
3436 , date
@@ -138,6 +140,7 @@ foreign import cBoolean :: CreateComponent Boolean
138140foreign import cButton :: forall a . a -> CreateComponent a
139141foreign import cSelect :: forall a . Array a -> (a -> String ) -> CreateComponent a
140142foreign import cRadioGroup :: forall a . Array a -> (a -> String ) -> CreateComponent a
143+ foreign import cTextarea :: CreateComponent String
141144foreign import cColor :: CreateComponent String
142145
143146type DateRec = { year :: Int , month :: Int , day :: Int }
@@ -286,6 +289,15 @@ radioGroup label (default :| xs) toString =
286289radioGroup_ :: forall e f a . Foldable f => NonEmpty f a -> (a -> String ) -> UI e a
287290radioGroup_ = radioGroup " "
288291
292+ -- | Creates a textarea field for a `String` input from a given label and
293+ -- | default value.
294+ textarea :: forall e . Label -> String -> UI e String
295+ textarea = createUI cTextarea
296+
297+ -- | Like `textarea`, but without a label.
298+ textarea_ :: forall e . String -> UI e String
299+ textarea_ = textarea " "
300+
289301-- | Creates a color picker input field from a label and default `Color`.
290302color :: forall e . Label -> Color -> UI e Color
291303color label default = (fromMaybe default <<< fromHexString) <$>
You can’t perform that action at this time.
0 commit comments