Module

Turbine.HTML.Elements

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.Elements as E

#Attributes' Source

type Attributes' r = (class :: ClassDescription, id :: Behavior String | r)

#Output' Source

type Output' r = (blur :: Stream FocusEvent, click :: Stream Unit, dblclick :: Stream Unit, keydown :: Stream KeyboardEvent, keyup :: Stream KeyboardEvent | r)

#h1 Source

h1 :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o Output

#h1_ Source

h1_ :: forall p o. Component o p -> Component o Output

#div Source

div :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o Output

#div_ Source

div_ :: forall p o. Component o p -> Component o Output

#br Source

br :: Component (Record ()) Unit

A br element. Note that this is a constant and not a function since a br elements takes neither attributes nor children.

#p Source

p :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o Output

#p_ Source

p_ :: forall p o. Component o p -> Component o Output

#text Source

text :: String -> Component (Record ()) Unit

Creates a static text node based on the given string.

For a dynamic version see textB.

#textB Source

textB :: Behavior String -> Component (Record ()) Unit

Creates a dynamic text node based on the given string valued behavior. The value of the text node is always equal to the value of the behavior.

#ul Source

ul :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o Output

#ul_ Source

ul_ :: forall p o. Component o p -> Component o Output

#li Source

li :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o Output

#li_ Source

li_ :: forall p o. Component o p -> Component o Output

#span Source

span :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o Output

#span_ Source

span_ :: forall p o. Component o p -> Component o Output

#InputAttrs' Source

type InputAttrs' r = (autofocus :: Behavior Boolean, placeholder :: Behavior String, type :: Behavior String, value :: Behavior String | Attributes' + r)

#InputAttrs Source

#InputOut' Source

type InputOut' r = (input :: Stream InputEvent, keyup :: Stream KeyboardEvent, value :: Behavior String | Output' + r)

#InputOut Source

#input Source

input :: forall a. Subrow a InputAttrs => Record a -> Component (Record ()) InputOut

#inputRange Source

inputRange :: forall a. Subrow a (InputRangeAttrs' ()) => Record a -> Component (Record ()) (Record (InputRangeOut' ()))

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.

#textarea Source

#button Source

button :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o ButtonOut

#button_ Source

button_ :: forall p o. Component o p -> Component o ButtonOut

#label Source

label :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o Output

#label_ Source

label_ :: forall p o. Component o p -> Component o Output

#section Source

section :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o Output

#section_ Source

section_ :: forall p o. Component o p -> Component o Output

#header Source

header :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o Output

#header_ Source

header_ :: forall p o. Component o p -> Component o Output

#footer Source

footer :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o Output

#footer_ Source

footer_ :: forall p o. Component o p -> Component o Output

#table Source

table :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o Output

#table_ Source

table_ :: forall p o. Component o p -> Component o Output

#th Source

th :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o Output

#th_ Source

th_ :: forall p o. Component o p -> Component o Output

#tr Source

tr :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o Output

#tr_ Source

tr_ :: forall p o. Component o p -> Component o Output

#td Source

td :: forall p o a. Subrow a Attributes => Record a -> Component o p -> Component o Output

#td_ Source

td_ :: forall p o. Component o p -> Component o Output

#progress Source

progress :: forall p o a. Subrow a ProgressAttrs => Record a -> Component o p -> Component o Output

#progress_ Source

progress_ :: forall p o. Component o p -> Component o Output

#empty Source

empty :: Component (Record ()) Unit

An empty component corresponding to no HTML nor effects.

#Subrow Source

class Subrow (r :: Row Type) (s :: Row Type) 

Instances

#RecordOf Source

class RecordOf a (row :: Row Type) | row -> a where

Members

Instances

#RecordOfGo Source

class RecordOfGo (xs :: RowList) (row :: Row Type) a | xs -> row a where

Members

Instances

#ClassDescription Source

#ClassElement Source

#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 "foo bar baz"

#toggleClass Source

toggleClass :: forall r. RecordOf (Behavior Boolean) r => Record r -> ClassDescription

Takes a record of boolean valued behaviors. Each key or field in the record is interpreted as a class name. When a behavior is true the class corresponding to the behavior is added to the element and when it is false it does not exist on the element.

toggleClass
  { active: isActiveBehavior
  , selected: isSelectedBehavior
  }