| 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 action
- className :: MisoString -> Attribute action
- classes_ :: [MisoString] -> Attribute action
- classList_ :: [(MisoString, Bool)] -> Attribute action
- id_ :: MisoString -> Attribute action
- title_ :: MisoString -> Attribute action
- hidden_ :: Bool -> Attribute action
- inert_ :: Bool -> Attribute action
- lang_ :: MisoString -> Attribute action
- type_ :: MisoString -> Attribute action
- value_ :: MisoString -> Attribute action
- defaultValue_ :: MisoString -> Attribute action
- checked_ :: Bool -> Attribute action
- placeholder_ :: MisoString -> Attribute action
- selected_ :: Bool -> Attribute action
- accept_ :: MisoString -> Attribute action
- acceptCharset_ :: MisoString -> Attribute action
- action_ :: MisoString -> Attribute action
- autocomplete_ :: Bool -> Attribute action
- autofocus_ :: Bool -> Attribute action
- autosave_ :: MisoString -> Attribute action
- disabled_ :: Attribute action
- enctype_ :: MisoString -> Attribute action
- formation_ :: MisoString -> Attribute action
- list_ :: MisoString -> Attribute action
- maxlength_ :: MisoString -> Attribute action
- minlength_ :: MisoString -> Attribute action
- method_ :: MisoString -> Attribute action
- multiple_ :: Bool -> Attribute action
- name_ :: MisoString -> Attribute action
- noValidate_ :: Bool -> Attribute action
- pattern_ :: MisoString -> Attribute action
- readonly_ :: Bool -> Attribute action
- required_ :: Bool -> Attribute action
- size_ :: MisoString -> Attribute action
- for_ :: MisoString -> Attribute action
- ref_ :: MisoString -> Attribute action
- form_ :: MisoString -> Attribute action
- max_ :: MisoString -> Attribute action
- min_ :: MisoString -> Attribute action
- step_ :: MisoString -> Attribute action
- cols_ :: MisoString -> Attribute action
- rows_ :: MisoString -> Attribute action
- wrap_ :: MisoString -> Attribute action
- href_ :: MisoString -> Attribute action
- target_ :: MisoString -> Attribute action
- download_ :: MisoString -> Attribute action
- downloadAs_ :: MisoString -> Attribute action
- hreflang_ :: MisoString -> Attribute action
- media_ :: MisoString -> Attribute action
- ping_ :: MisoString -> Attribute action
- rel_ :: MisoString -> Attribute action
- ismap_ :: Bool -> Attribute action
- usemap_ :: MisoString -> Attribute action
- shape_ :: MisoString -> Attribute action
- coords_ :: MisoString -> Attribute action
- src_ :: MisoString -> Attribute action
- height_ :: MisoString -> Attribute action
- width_ :: MisoString -> Attribute action
- alt_ :: MisoString -> Attribute action
- loading_ :: MisoString -> Attribute action
- autoplay_ :: Bool -> Attribute action
- currentTime_ :: Double -> Attribute action
- defaultMuted_ :: Bool -> Attribute action
- volume_ :: Double -> Attribute action
- controls_ :: Bool -> Attribute action
- loop_ :: Bool -> Attribute action
- defaultPlaybackRate_ :: Double -> Attribute action
- mediaGroup_ :: MisoString -> Attribute action
- muted_ :: Bool -> Attribute action
- playbackRate_ :: Double -> Attribute action
- seeking_ :: Bool -> Attribute action
- preload_ :: MisoString -> Attribute action
- poster_ :: MisoString -> Attribute action
- default_ :: Bool -> Attribute action
- kind_ :: MisoString -> Attribute action
- srclang_ :: MisoString -> Attribute action
- sandbox_ :: MisoString -> Attribute action
- seamless_ :: MisoString -> Attribute action
- srcdoc_ :: MisoString -> Attribute action
- reversed_ :: Bool -> Attribute action
- align_ :: MisoString -> Attribute action
- colspan_ :: MisoString -> Attribute action
- rowspan_ :: MisoString -> Attribute action
- headers_ :: MisoString -> Attribute action
- scope_ :: MisoString -> Attribute action
- async_ :: Bool -> Attribute action
- charset_ :: MisoString -> Attribute action
- content_ :: MisoString -> Attribute action
- defer_ :: Bool -> Attribute action
- httpEquiv_ :: MisoString -> Attribute action
- language_ :: MisoString -> Attribute action
- scoped_ :: MisoString -> Attribute action
- data_ :: MisoString -> MisoString -> Attribute action
- autocorrect_ :: Bool -> Attribute action
- spellcheck_ :: Bool -> Attribute action
- role_ :: MisoString -> Attribute action
- xmlns_ :: MisoString -> Attribute action
- aria_ :: MisoString -> MisoString -> Attribute action
- label_ :: MisoString -> Attribute action
- draggable_ :: Bool -> Attribute action
- frameborder_ :: MisoString -> Attribute action
- scrolling_ :: MisoString -> Attribute action
- tabindex_ :: MisoString -> Attribute action
- open_ :: Bool -> Attribute action
Combinators
class_ :: MisoString -> Attribute action Source #
Set "className" property https://developer.mozilla.org/en-US/docs/Web/API/Element/className
className :: MisoString -> Attribute action Source #
Set "className" property https://developer.mozilla.org/en-US/docs/Web/API/Element/className
classes_ :: [MisoString] -> Attribute action Source #
Define multiple classes
div_ [ classes_ [ "red", "warning" ] ] []
classList_ :: [(MisoString, Bool)] -> Attribute action Source #
Define multiple classes conditionally
div_ [ classList_ [ ("empty", null items) ] [ ]id_ :: MisoString -> Attribute action Source #
title_ :: MisoString -> Attribute action Source #
lang_ :: MisoString -> Attribute action Source #
type_ :: MisoString -> Attribute action Source #
value_ :: MisoString -> Attribute action Source #
defaultValue_ :: MisoString -> Attribute action Source #
placeholder_ :: MisoString -> Attribute action Source #
accept_ :: MisoString -> Attribute action Source #
acceptCharset_ :: MisoString -> Attribute action Source #
action_ :: MisoString -> Attribute action Source #
autocomplete_ :: Bool -> Attribute action Source #
autofocus_ :: Bool -> Attribute action Source #
autosave_ :: MisoString -> Attribute action Source #
enctype_ :: MisoString -> Attribute action Source #
formation_ :: MisoString -> Attribute action Source #
list_ :: MisoString -> Attribute action Source #
maxlength_ :: MisoString -> Attribute action Source #
minlength_ :: MisoString -> Attribute action Source #
method_ :: MisoString -> Attribute action Source #
name_ :: MisoString -> Attribute action Source #
noValidate_ :: Bool -> Attribute action Source #
pattern_ :: MisoString -> Attribute action Source #
size_ :: MisoString -> Attribute action Source #
for_ :: MisoString -> Attribute action Source #
ref_ :: MisoString -> Attribute action Source #
form_ :: MisoString -> Attribute action Source #
max_ :: MisoString -> Attribute action Source #
min_ :: MisoString -> Attribute action Source #
step_ :: MisoString -> Attribute action Source #
cols_ :: MisoString -> Attribute action Source #
rows_ :: MisoString -> Attribute action Source #
wrap_ :: MisoString -> Attribute action Source #
href_ :: MisoString -> Attribute action Source #
target_ :: MisoString -> Attribute action Source #
download_ :: MisoString -> Attribute action Source #
downloadAs_ :: MisoString -> Attribute action Source #
hreflang_ :: MisoString -> Attribute action Source #
media_ :: MisoString -> Attribute action Source #
ping_ :: MisoString -> Attribute action Source #
rel_ :: MisoString -> Attribute action Source #
usemap_ :: MisoString -> Attribute action Source #
shape_ :: MisoString -> Attribute action Source #
coords_ :: MisoString -> Attribute action Source #
src_ :: MisoString -> Attribute action Source #
height_ :: MisoString -> Attribute action Source #
width_ :: MisoString -> Attribute action Source #
alt_ :: MisoString -> Attribute action Source #
loading_ :: MisoString -> Attribute action Source #
currentTime_ :: Double -> Attribute action Source #
defaultMuted_ :: Bool -> Attribute action Source #
defaultPlaybackRate_ :: Double -> Attribute action Source #
mediaGroup_ :: MisoString -> Attribute action Source #
playbackRate_ :: Double -> Attribute action Source #
preload_ :: MisoString -> Attribute action Source #
poster_ :: MisoString -> Attribute action Source #
kind_ :: MisoString -> Attribute action Source #
srclang_ :: MisoString -> Attribute action Source #
sandbox_ :: MisoString -> Attribute action Source #
seamless_ :: MisoString -> Attribute action Source #
srcdoc_ :: MisoString -> Attribute action Source #
align_ :: MisoString -> Attribute action Source #
colspan_ :: MisoString -> Attribute action Source #
rowspan_ :: MisoString -> Attribute action Source #
headers_ :: MisoString -> Attribute action Source #
scope_ :: MisoString -> Attribute action Source #
charset_ :: MisoString -> Attribute action Source #
content_ :: MisoString -> Attribute action Source #
httpEquiv_ :: MisoString -> Attribute action Source #
language_ :: MisoString -> Attribute action Source #
scoped_ :: MisoString -> Attribute action Source #
data_ :: MisoString -> MisoString -> Attribute action Source #
Set "data-*" property https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*
autocorrect_ :: Bool -> Attribute action Source #
spellcheck_ :: Bool -> Attribute action Source #
role_ :: MisoString -> Attribute action Source #
xmlns_ :: MisoString -> Attribute action Source #
Since: 1.9.0.0
aria_ :: MisoString -> MisoString -> Attribute action Source #
Since: 1.9.0.0
label_ :: MisoString -> Attribute action Source #
Since: 1.9.0.0
draggable_ :: Bool -> Attribute action Source #
Since: 1.9.0.0
frameborder_ :: MisoString -> Attribute action Source #
Since: 1.9.0.0
scrolling_ :: MisoString -> Attribute action Source #
Since: 1.9.0.0