File tree 2 files changed +25
-0
lines changed 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) {
296
296
} ;
297
297
} ;
298
298
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
+
299
312
exports . toFieldset = function ( label ) {
300
313
return function ( elements ) {
301
314
var fieldset = document . createElement ( "fieldset" ) ;
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ module Flare
29
29
, select_
30
30
, radioGroup
31
31
, radioGroup_
32
+ , textarea
33
+ , textarea_
32
34
, color
33
35
, color_
34
36
, date
@@ -138,6 +140,7 @@ foreign import cBoolean :: CreateComponent Boolean
138
140
foreign import cButton :: forall a . a -> CreateComponent a
139
141
foreign import cSelect :: forall a . Array a -> (a -> String ) -> CreateComponent a
140
142
foreign import cRadioGroup :: forall a . Array a -> (a -> String ) -> CreateComponent a
143
+ foreign import cTextarea :: CreateComponent String
141
144
foreign import cColor :: CreateComponent String
142
145
143
146
type DateRec = { year :: Int , month :: Int , day :: Int }
@@ -286,6 +289,15 @@ radioGroup label (default :| xs) toString =
286
289
radioGroup_ :: forall e f a . Foldable f => NonEmpty f a -> (a -> String ) -> UI e a
287
290
radioGroup_ = radioGroup " "
288
291
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
+
289
301
-- | Creates a color picker input field from a label and default `Color`.
290
302
color :: forall e . Label -> Color -> UI e Color
291
303
color label default = (fromMaybe default <<< fromHexString) <$>
You can’t perform that action at this time.
0 commit comments