Turbine.HTML
- Package
- purescript-turbine
- Repository
- funkia/purescript-turbine
This module contains Turbines DSL for constructing HTML.
This module is typically imported qualified as.
import Turbine.HTML as H
#Attributes' Source
type Attributes' r = (class :: Behavior String, classes :: ClassDescription, id :: Behavior String | r)
This type describes the attributes that all HTML elements accepts.
#Output' Source
type Output' r = (blur :: Stream FocusEvent, click :: Stream MouseEvent, dblclick :: Stream MouseEvent, keydown :: Stream KeyboardEvent, keyup :: Stream KeyboardEvent | r)
This type describes the output that all HTML elements output.
#InputAttrs Source
type InputAttrs = InputAttrs' ()
#InputOut' Source
type InputOut' r = (input :: Stream InputEvent, keyup :: Stream KeyboardEvent, value :: Behavior String | Output' + r)
#checkbox Source
checkbox :: forall r. Subrow r CheckboxAttrs => Record r -> Component CheckboxOutput (Record ())
An input element with the type
attribute set to checkbox
.
Most notably a checkbox
outputs a behavior named checked
denoting
whether or not the checkbox is currently checked.
#inputRange Source
inputRange :: forall r. Subrow r (InputRangeAttrs' ()) => Record r -> Component (Record (InputRangeOut' ())) (Record ())
An input element with the type
attribute set to range
. Compared to a
normal a normal input element this variant accepts three additional
attributes all of which are numbers: max
, min
, and step
. Additionally
the value
output is a Number
and not a String
.
#RecordOfGo Source
class RecordOfGo (xs :: RowList) (row :: Row Type) a | xs -> row a where
Members
Instances
(IsSymbol name, RowToList row rx, Cons name a trash row, RecordOfGo xs' row a) => RecordOfGo (Cons name a xs') row a
RecordOfGo Nil row a
#ClassElement Source
data ClassElement :: Type
#staticClass Source
staticClass :: String -> ClassDescription
Creates a static class from a string of space separated class names.
staticClass "foo bar baz"
#dynamicClass Source
dynamicClass :: Behavior String -> ClassDescription
Creates a dynamic class from a string valued behavior. At any point in time the element will have the class named in the behavior at that point in time.
dynamicClass stringValuedBehavior
#toggleClass Source
toggleClass :: String -> Behavior Boolean -> ClassDescription
Takes a class name and a boolean valued behavior. When the behavior is
true
the element has the class and when the behavior is false
the
element does not have the class.
toggleClass "active" isActiveBehavior
<> toggleClass "selected" isSelectedBehavior
- Modules
- Turbine
- Turbine.
HTML
Class descriptions form a semigroup. This makes it convenient to combine several types of description and add them to the same element.