| Copyright | (C) 2016-2026 David M. Johnson |
|---|---|
| License | BSD3-style (see the file LICENSE) |
| Maintainer | David M. Johnson <code@dmj.io> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Miso.Html.Property
Contents
Description
Overview
Miso.Html.Property provides smart constructors for
DOM properties
and
HTML attributes.
Each produces an Attribute that the virtual DOM applies to
the corresponding DOM node on every render, diffing only changed values.
All names are suffixed with _ to avoid clashing with Haskell
Prelude names. This module is re-exported in its entirety by
Miso.Html and Miso.
Quick start
import Miso view :: Model ->ViewModel Action view m =div_[id_"app",class_"container" ] [input_[type_"text" ,value_m.text ,placeholder_"Type here…" ,disabled_] [] ,img_[src_"logo.png",alt_"Logo",width_"64",height_"64" ] [] ]
Class management
Four combinators handle CSS classes:
class_"foo bar" -- single string, set classNameclassName"foo bar" -- alias for class_classes_["foo", "bar"] -- list of class namesclassList_[("active", isActive) -- conditional classes ,("error", hasError)]
Property groups
- Global:
id_,class_,className,classes_,classList_,title_,lang_,hidden_,inert_,draggable_,tabindex_,role_,data_,aria_,xmlns_ - Form:
type_,value_,defaultValue_,checked_,placeholder_,selected_,disabled_,readonly_,required_,multiple_,autofocus_,autocomplete_,autocorrect_,spellcheck_,name_,for_,form_,action_,method_,enctype_,noValidate_,accept_,acceptCharset_,pattern_,min_,max_,step_,size_,maxlength_,minlength_,list_,cols_,rows_,wrap_ - Link / anchor:
href_,target_,rel_,hreflang_,download_,downloadAs_,ping_,media_ - Image / map:
src_,alt_,width_,height_,loading_,ismap_,usemap_,shape_,coords_ - Media:
autoplay_,controls_,loop_,muted_,preload_,poster_,volume_,currentTime_,defaultMuted_,defaultPlaybackRate_,playbackRate_,seeking_,mediaGroup_ - Table:
colspan_,rowspan_,headers_,scope_,align_ - <script> / <meta>:
async_,defer_,charset_,content_,httpEquiv_,language_,scoped_ - <iframe>:
sandbox_,seamless_,srcdoc_,frameborder_,scrolling_ - Misc:
open_,reversed_,default_,kind_,srclang_,label_,autosave_,formation_,ref_
See also
- Miso.Property — lower-level
textProp,boolProp,intProp,doublePropcombinators - Miso.Html.Element — element constructors that accept these attributes
- Miso.Html.Event — event-handler attributes
- Miso.CSS — style property DSL (
style_,styleInline_)
Synopsis
- class_ :: MisoString -> Attribute model action
- className :: MisoString -> Attribute model action
- classes_ :: [MisoString] -> Attribute model action
- classList_ :: [(MisoString, Bool)] -> Attribute model action
- id_ :: MisoString -> Attribute model action
- title_ :: MisoString -> Attribute model action
- hidden_ :: Bool -> Attribute model action
- inert_ :: Bool -> Attribute model action
- lang_ :: MisoString -> Attribute model action
- type_ :: MisoString -> Attribute model action
- value_ :: MisoString -> Attribute model action
- defaultValue_ :: MisoString -> Attribute model action
- checked_ :: Bool -> Attribute model action
- placeholder_ :: MisoString -> Attribute model action
- selected_ :: Bool -> Attribute model action
- accept_ :: MisoString -> Attribute model action
- acceptCharset_ :: MisoString -> Attribute model action
- action_ :: MisoString -> Attribute model action
- autocomplete_ :: MisoString -> Attribute model action
- autofocus_ :: Bool -> Attribute model action
- autosave_ :: MisoString -> Attribute model action
- disabled_ :: Attribute model action
- enctype_ :: MisoString -> Attribute model action
- formation_ :: MisoString -> Attribute model action
- list_ :: MisoString -> Attribute model action
- maxlength_ :: MisoString -> Attribute model action
- minlength_ :: MisoString -> Attribute model action
- method_ :: MisoString -> Attribute model action
- multiple_ :: Bool -> Attribute model action
- name_ :: MisoString -> Attribute model action
- noValidate_ :: Bool -> Attribute model action
- pattern_ :: MisoString -> Attribute model action
- readonly_ :: Bool -> Attribute model action
- required_ :: Bool -> Attribute model action
- size_ :: MisoString -> Attribute model action
- for_ :: MisoString -> Attribute model action
- ref_ :: MisoString -> Attribute model action
- form_ :: MisoString -> Attribute model action
- max_ :: MisoString -> Attribute model action
- min_ :: MisoString -> Attribute model action
- step_ :: MisoString -> Attribute model action
- cols_ :: MisoString -> Attribute model action
- rows_ :: MisoString -> Attribute model action
- wrap_ :: MisoString -> Attribute model action
- href_ :: MisoString -> Attribute model action
- target_ :: MisoString -> Attribute model action
- download_ :: MisoString -> Attribute model action
- downloadAs_ :: MisoString -> Attribute model action
- hreflang_ :: MisoString -> Attribute model action
- media_ :: MisoString -> Attribute model action
- ping_ :: MisoString -> Attribute model action
- rel_ :: MisoString -> Attribute model action
- ismap_ :: Bool -> Attribute model action
- usemap_ :: MisoString -> Attribute model action
- shape_ :: MisoString -> Attribute model action
- coords_ :: MisoString -> Attribute model action
- src_ :: MisoString -> Attribute model action
- height_ :: MisoString -> Attribute model action
- width_ :: MisoString -> Attribute model action
- alt_ :: MisoString -> Attribute model action
- loading_ :: MisoString -> Attribute model action
- autoplay_ :: Bool -> Attribute model action
- currentTime_ :: Double -> Attribute model action
- defaultMuted_ :: Bool -> Attribute model action
- volume_ :: Double -> Attribute model action
- controls_ :: Bool -> Attribute model action
- loop_ :: Bool -> Attribute model action
- defaultPlaybackRate_ :: Double -> Attribute model action
- mediaGroup_ :: MisoString -> Attribute model action
- muted_ :: Bool -> Attribute model action
- playbackRate_ :: Double -> Attribute model action
- seeking_ :: Bool -> Attribute model action
- preload_ :: MisoString -> Attribute model action
- poster_ :: MisoString -> Attribute model action
- default_ :: Bool -> Attribute model action
- kind_ :: MisoString -> Attribute model action
- srclang_ :: MisoString -> Attribute model action
- sandbox_ :: MisoString -> Attribute model action
- seamless_ :: MisoString -> Attribute model action
- srcdoc_ :: MisoString -> Attribute model action
- reversed_ :: Bool -> Attribute model action
- align_ :: MisoString -> Attribute model action
- colspan_ :: MisoString -> Attribute model action
- rowspan_ :: MisoString -> Attribute model action
- headers_ :: MisoString -> Attribute model action
- scope_ :: MisoString -> Attribute model action
- async_ :: Bool -> Attribute model action
- charset_ :: MisoString -> Attribute model action
- content_ :: MisoString -> Attribute model action
- defer_ :: Bool -> Attribute model action
- httpEquiv_ :: MisoString -> Attribute model action
- language_ :: MisoString -> Attribute model action
- scoped_ :: MisoString -> Attribute model action
- data_ :: MisoString -> MisoString -> Attribute model action
- autocorrect_ :: Bool -> Attribute model action
- spellcheck_ :: Bool -> Attribute model action
- role_ :: MisoString -> Attribute model action
- xmlns_ :: MisoString -> Attribute model action
- aria_ :: MisoString -> MisoString -> Attribute model action
- label_ :: MisoString -> Attribute model action
- draggable_ :: Bool -> Attribute model action
- frameborder_ :: MisoString -> Attribute model action
- scrolling_ :: MisoString -> Attribute model action
- tabindex_ :: MisoString -> Attribute model action
- open_ :: Bool -> Attribute model action
Combinators
class_ :: MisoString -> Attribute model action Source #
Set "className" property https://developer.mozilla.org/en-US/docs/Web/API/Element/className
className :: MisoString -> Attribute model action Source #
Set "className" property https://developer.mozilla.org/en-US/docs/Web/API/Element/className
classes_ :: [MisoString] -> Attribute model action Source #
Define multiple classes
div_ [ classes_ [ "red", "warning" ] ] []
classList_ :: [(MisoString, Bool)] -> Attribute model action Source #
Define multiple classes conditionally
div_ [ classList_ [ ("empty", null items) ] [ ]id_ :: MisoString -> Attribute model action Source #
title_ :: MisoString -> Attribute model action Source #
lang_ :: MisoString -> Attribute model action Source #
type_ :: MisoString -> Attribute model action Source #
value_ :: MisoString -> Attribute model action Source #
defaultValue_ :: MisoString -> Attribute model action Source #
placeholder_ :: MisoString -> Attribute model action Source #
accept_ :: MisoString -> Attribute model action Source #
acceptCharset_ :: MisoString -> Attribute model action Source #
action_ :: MisoString -> Attribute model action Source #
autocomplete_ :: MisoString -> Attribute model action Source #
autofocus_ :: Bool -> Attribute model action Source #
autosave_ :: MisoString -> Attribute model action Source #
enctype_ :: MisoString -> Attribute model action Source #
formation_ :: MisoString -> Attribute model action Source #
list_ :: MisoString -> Attribute model action Source #
maxlength_ :: MisoString -> Attribute model action Source #
minlength_ :: MisoString -> Attribute model action Source #
method_ :: MisoString -> Attribute model action Source #
name_ :: MisoString -> Attribute model action Source #
noValidate_ :: Bool -> Attribute model action Source #
pattern_ :: MisoString -> Attribute model action Source #
size_ :: MisoString -> Attribute model action Source #
for_ :: MisoString -> Attribute model action Source #
ref_ :: MisoString -> Attribute model action Source #
form_ :: MisoString -> Attribute model action Source #
max_ :: MisoString -> Attribute model action Source #
min_ :: MisoString -> Attribute model action Source #
step_ :: MisoString -> Attribute model action Source #
cols_ :: MisoString -> Attribute model action Source #
rows_ :: MisoString -> Attribute model action Source #
wrap_ :: MisoString -> Attribute model action Source #
href_ :: MisoString -> Attribute model action Source #
target_ :: MisoString -> Attribute model action Source #
download_ :: MisoString -> Attribute model action Source #
downloadAs_ :: MisoString -> Attribute model action Source #
hreflang_ :: MisoString -> Attribute model action Source #
media_ :: MisoString -> Attribute model action Source #
ping_ :: MisoString -> Attribute model action Source #
rel_ :: MisoString -> Attribute model action Source #
usemap_ :: MisoString -> Attribute model action Source #
shape_ :: MisoString -> Attribute model action Source #
coords_ :: MisoString -> Attribute model action Source #
src_ :: MisoString -> Attribute model action Source #
height_ :: MisoString -> Attribute model action Source #
width_ :: MisoString -> Attribute model action Source #
alt_ :: MisoString -> Attribute model action Source #
loading_ :: MisoString -> Attribute model action Source #
currentTime_ :: Double -> Attribute model action Source #
defaultMuted_ :: Bool -> Attribute model action Source #
defaultPlaybackRate_ :: Double -> Attribute model action Source #
mediaGroup_ :: MisoString -> Attribute model action Source #
playbackRate_ :: Double -> Attribute model action Source #
preload_ :: MisoString -> Attribute model action Source #
poster_ :: MisoString -> Attribute model action Source #
kind_ :: MisoString -> Attribute model action Source #
srclang_ :: MisoString -> Attribute model action Source #
sandbox_ :: MisoString -> Attribute model action Source #
seamless_ :: MisoString -> Attribute model action Source #
srcdoc_ :: MisoString -> Attribute model action Source #
align_ :: MisoString -> Attribute model action Source #
colspan_ :: MisoString -> Attribute model action Source #
rowspan_ :: MisoString -> Attribute model action Source #
headers_ :: MisoString -> Attribute model action Source #
scope_ :: MisoString -> Attribute model action Source #
charset_ :: MisoString -> Attribute model action Source #
content_ :: MisoString -> Attribute model action Source #
httpEquiv_ :: MisoString -> Attribute model action Source #
language_ :: MisoString -> Attribute model action Source #
scoped_ :: MisoString -> Attribute model action Source #
data_ :: MisoString -> MisoString -> Attribute model action Source #
Set "data-*" property https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*
autocorrect_ :: Bool -> Attribute model action Source #
spellcheck_ :: Bool -> Attribute model action Source #
role_ :: MisoString -> Attribute model action Source #
xmlns_ :: MisoString -> Attribute model action Source #
Since: 1.9.0.0
aria_ :: MisoString -> MisoString -> Attribute model action Source #
Since: 1.9.0.0
label_ :: MisoString -> Attribute model action Source #
Since: 1.9.0.0
draggable_ :: Bool -> Attribute model action Source #
Since: 1.9.0.0
frameborder_ :: MisoString -> Attribute model action Source #
Since: 1.9.0.0
scrolling_ :: MisoString -> Attribute model action Source #
Since: 1.9.0.0