Elements - Generic Elements¶
Generic Elements¶
Source code: hyccup/element.hy
Functions for creating generic HTML elements.
- (hyccup.element.javascript-tag script)¶
Wrap the supplied javascript up in script tags and a CDATA section.
- (hyccup.element.link-to #* args #** kwargs)¶
Wrap some content in a HTML hyperlink with the supplied URL.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
url – The hypertext link
*content – Content do include as children
- (hyccup.element.mail-to #* args #** kwargs)¶
Wrap some content in a HTML hyperlink with the supplied e-mail address.
If no content provided use the e-mail address as content.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
email – E-mail address
*content – Content do include as children
- (hyccup.element.unordered-list #* args #** kwargs)¶
Wrap a collection in an unordered list.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
coll – Collection of elements of the list.
- (hyccup.element.ordered-list #* args #** kwargs)¶
Wrap a collection in an ordered list.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
coll – Collection of elements of the list.
- (hyccup.element.image #* args #** kwargs)¶
Create an image element.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
src – The source of the image
alt – Alternative text for the image
Form Elements¶
Source code: hyccup/form.hy
Functions for generating HTML forms and input fields.
- (hyccup.form.group #* args #** kwds)¶
Group together a set of related form fields.
- (hyccup.form.input-field type name value)¶
Create a new <input> element.
Create a hidden input field.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
name – The name of the field
value – Its value (default: None)
- (hyccup.form.text-field #* args #** kwargs)¶
Create a new text input field.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
name – The name of the field
value – Its value (default: None)
- (hyccup.form.password-field #* args #** kwargs)¶
Create a new password field.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
name – The name of the field
value – Its value (default: None)
- (hyccup.form.email-field #* args #** kwargs)¶
Create a new email input field.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
name – The name of the field
value – Its value (default: None)
- (hyccup.form.check-box #* args #** kwargs)¶
Create a check box.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
name – The name of the checkbox
checked? – Boolean attribute “checked” (default: None)
value – Its value (default: “true”)
- (hyccup.form.radio-button #* args #** kwargs)¶
Create a radio button.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
group – The group of the radio button
checked? – Boolean attribute “checked” (default: None)
value – Its value (default: “true”)
- (hyccup.form.select-options #* args #** kwargs)¶
Create a seq of option tags from a collection.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
coll – Collection of options. Items should be (text, val)
selected – Selected item (an available value) (default: None)
- (hyccup.form.drop-down #* args #** kwargs)¶
Create a drop-down box using the <select> tag.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
options – A collection of options (passed to
select-options
)selected – Selected option (passed to
select-options
)
- (hyccup.form.text-area #* args #** kwargs)¶
Create a text area element.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
name – The name of the text area
value – Its value (default: None)
- (hyccup.form.file-upload #* args #** kwargs)¶
Create a file upload input.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
name – The name of the field
- (hyccup.form.label #* args #** kwargs)¶
Create a label for an input field with the supplied name.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
name – The name of the field
text – Its text
- (hyccup.form.submit-button #* args #** kwargs)¶
Create a submit button.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
name – The text of the button
- (hyccup.form.reset-button #* args #** kwargs)¶
Create a form reset button.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
name – The text of the button
- (hyccup.form.form-to #* args #** kwargs)¶
Create a form that points to a particular method and route.
- Parameters
attrs-map – Optional dict of attributes as first positional parameter
method-and-action – collection containing method and action (e.g.
["post" "/foo"]
)*body – The body of the form