Module Tw_html.AtSource

HTML attributes.

Sourceval id : string -> attr

id "my-id" is an id attribute.

Sourceval class' : string -> attr

class' names is a class attribute. The names in names that are utilities join the element's ~tw ones, and the others are rendered as given and reported by unknown_classes.

Global attributes

Sourceval title : string -> attr

title s is a title attribute.

Sourceval lang : string -> attr

lang "en" is a lang attribute.

Sourceval dir : string -> attr

dir "ltr" is a dir attribute.

Sourceval tabindex : int -> attr

tabindex 0 is a tabindex attribute.

Sourceval contenteditable : bool -> attr

contenteditable true is a contenteditable attribute.

Sourceval spellcheck : string -> attr

spellcheck v is a spellcheck attribute, v being "true" or "false".

Event attributes

Sourceval onclick : string -> attr

onclick "..." is an onclick attribute.

Sourceval onchange : string -> attr

onchange "..." is an onchange attribute.

Sourceval oninput : string -> attr

oninput "..." is an oninput attribute.

Sourceval onsubmit : string -> attr

onsubmit "..." is an onsubmit attribute.

Form attributes

Sourceval type' : string -> attr

type' "text/css" is a type attribute.

Sourceval value : string -> attr

value "..." is a value attribute.

Sourceval name : string -> attr

name "description" is a name attribute.

Sourceval placeholder : string -> attr

placeholder "..." is a placeholder attribute.

Sourceval required : attr

required is the required attribute.

Sourceval disabled : attr

disabled is the disabled attribute.

Sourceval checked : attr

checked is the checked attribute.

Sourceval readonly : attr

readonly is the readonly attribute.

Sourceval href : string -> attr

href "/path" is an href attribute.

Sourceval target : string -> attr

target "_blank" is a target attribute.

Sourceval rel : string -> attr

rel "stylesheet" is a rel attribute.

Sourceval download : string -> attr

download "file.pdf" is a download attribute.

Media attributes

Sourceval src : string -> attr

src "/image.png" is a src attribute.

Sourceval alt : string -> attr

alt "description" is an alt attribute for images.

Sourceval width : int -> attr

width 800 is a width attribute.

Sourceval height : int -> attr

height 600 is a height attribute.

Sourceval loading : string -> attr

loading "lazy" is a loading attribute.

Meta attributes

Sourceval charset : string -> attr

charset "utf-8" is a charset attribute.

Sourceval content : string -> attr

content "..." is a content attribute.

Sourceval property : string -> attr

property "og:title" is a property attribute.

Style attribute

Sourceval style : string -> attr

style "color:red;" is a style attribute.

Time attributes

Sourceval datetime : string -> attr

datetime "2025-07-28" is a datetime attribute.

Image attributes

Sourceval srcset : string -> attr

srcset "..." is a srcset attribute for responsive images.

Sourceval sizes : string -> attr

sizes "..." is a sizes attribute for responsive images.

Additional attributes

Sourceval title' : string -> attr

title' s is title s.

Sourceval loading_lazy : attr

loading_lazy is loading "lazy".

Sourceval v : string -> string -> attr

v key value is the attribute key with value value.

Sourceval void : attr

void is an attribute that does not render.

Sourceval true' : string -> attr

true' key is the boolean attribute key, with an empty value.

Sourceval false' : string -> attr

false' key is v key "false".

Sourceval if' : bool -> attr -> attr

if' cond at is at if cond is true and void otherwise.

Sourceval if_some : attr option -> attr

if_some o is at if o is Some at and void if o is None.

Sourceval is_void : attr -> bool

is_void at is true iff at is void.

Sourceval to_pair : attr -> string * string

to_pair at is the (name, value) pair of at.

Sourceval of_pair : (string * string) -> attr

of_pair (n, value) is v n value.

Additional HTML5 attributes

Sourceval accesskey : string -> attr

accesskey key is an accesskey attribute, the element's keyboard shortcut.

Sourceval action : string -> attr

action url is a form's action attribute.

Sourceval autocomplete : string -> attr

autocomplete value is an autocomplete attribute.

Sourceval autofocus : attr

autofocus is the autofocus attribute: the element takes the focus on page load.

Sourceval cols : int -> attr

cols n is a textarea's cols attribute.

Sourceval colspan : int -> attr

colspan n is a table cell's colspan attribute.

Sourceval defer : attr

defer is a script's defer attribute.

Sourceval draggable : bool -> attr

draggable b is a draggable attribute, "true" or "false".

Sourceval for' : string -> attr

for' id is a label's for attribute, naming the control id.

Sourceval hidden : attr

hidden is the hidden attribute.

Sourceval list : string -> attr

list id is an input's list attribute, naming the datalist id.

Sourceval method' : string -> attr

method' m is a form's method attribute.

Sourceval media : string -> attr

media query is a media attribute.

Sourceval popover : string -> attr

popover value is a popover attribute.

Sourceval popovertarget : string -> attr

popovertarget id is a popovertarget attribute naming the popover id.

Sourceval popovertargetaction : string -> attr

popovertargetaction action is a popovertargetaction attribute.

Sourceval rows : int -> attr

rows n is a textarea's rows attribute.

Sourceval rowspan : int -> attr

rowspan n is a table cell's rowspan attribute.

Sourceval selected : attr

selected is an option's selected attribute.

Sourceval wrap : string -> attr

wrap mode is a textarea's wrap attribute.

SVG Attributes

Sourceval fill_rule : [ `evenodd ] -> attr

fill_rule `evenodd is fill-rule="evenodd".

Sourceval clip_rule : [ `evenodd ] -> attr

clip_rule `evenodd is clip-rule="evenodd".

Sourceval cx : int -> attr

cx n is a cx attribute, the x coordinate of the centre.

Sourceval cy : int -> attr

cy n is a cy attribute, the y coordinate of the centre.

Sourceval r : int -> attr

r n is an r attribute, the radius.

Sourceval view_box : string -> attr

view_box s is a viewBox attribute.

Sourceval fill : string -> attr

fill "currentColor" is a fill attribute.

Sourceval stroke : string -> attr

stroke "currentColor" is a stroke attribute.

Sourceval stroke_width : string -> attr

stroke_width "2" is a stroke-width attribute.

Sourceval stroke_linecap : string -> attr

stroke_linecap "round" is a stroke-linecap attribute.

Sourceval stroke_linejoin : string -> attr

stroke_linejoin "round" is a stroke-linejoin attribute.

Sourceval x : string -> attr

x "10" is an x attribute.

Sourceval y : string -> attr

y "10" is a y attribute.

Sourceval rx : string -> attr

rx "5" is an rx attribute, the x radius of a rounded rectangle.

Sourceval d : string -> attr

d s is a d attribute, the path data.

Sourceval x1 : string -> attr

x1 "0" is an x1 attribute.

Sourceval y1 : string -> attr

y1 "0" is a y1 attribute.

Sourceval x2 : string -> attr

x2 "20" is an x2 attribute.

Sourceval y2 : string -> attr

y2 "20" is a y2 attribute.