package fmlib_browser

  1. Overview
  2. Docs

Attributes of Dom Elements.

Generic Interface

 

type 'msg t
val style : string -> string -> 'msg t
val property : string -> Value.t -> 'msg t
val attribute : string -> string -> 'msg t
val handler : string -> Event_flag.stop -> Event_flag.prevent -> 'msg Decoder.t -> 'msg t

Handler

val on : string -> 'msg Decoder.t -> 'msg t
val on_click : 'msg -> 'msg t

Common style attributes

val font_size : string -> 'msg t

Example font_size "20px"

Abbreviates style "font-size" "20px".

val color : string -> 'msg t

Example color "red"

Abbreviates style "color" "red".

val background_color : string -> 'msg t

Example background_color "powderblue"

Abbreviates style "background-color" "powderblue".

val height : string -> 'msg t

Example height "200px"

Abbreviates style "height" "200px".

val width : string -> 'msg t

Example width "200px"

Abbreviates style "width" "200px".

Margin, border, padding and content

               +--------------------------------+
               |         margin                 |
               |  +----border-----------------+ |
               |  |      padding              | |
               |  |   +---------------------+ | |
               |  |   |                     | | |
               |  |   |                     | | |
               |  |   |      content        | | |
               |  |   |                     | | |
               |  |   +---------------------+ | |
               |  +---------------------------+ |
               |                                |
               +--------------------------------+
val margin : string -> 'msg t

Examples

margin "25px"
margin "25px 50px"              top/bottom 25px, left/right 50px
margin "25px 50px 75px 100px"   top, right, bottom, left

margin str abbreviates style "margin" str

val padding : string -> 'msg t

Examples

padding "25px"
padding "25px 50px"              top/bottom 25px, left/right 50px
padding "25px 50px 75px 100px"   top, right, bottom, left

padding str abbreviates style "padding" str

val border_style : string -> 'msg t

Examples

border_style "solid"
border_style "dotted"
border_style "dashed"

border_style str abbreviates style "border-style" str

val border_width : string -> 'msg t

Examples

border_width "3px"
border_width "thick"
border_width "medium"
val border_color : string -> 'msg t

Example

border_color "red"

Common attributes

val id : string -> 'msg t

"id" attribute

val class_ : string -> 'msg t

"class" attribute

val href : string -> 'msg t

"href" attribute

val src : string -> 'msg t

"src" attribute

val title : string -> 'msg t

"title" attribute to display tooltips

Attributes for input elements

val value : string -> 'msg t
val placeholder : string -> 'msg t
val on_input : (string -> 'msg) -> 'msg t
OCaml

Innovation. Community. Security.