This project contains a lightweight (small download, no dependencies) set of styles and convenience functions to generate DOM elements such as links, tables, checkboxes and others.
Include a reference to css/ui.css
and js/ui.js
in your page.
A local variable nomisUI
is created through which access to the methods is provided.
Please see the example.htm
for a demonstration.
getQueryString(name)
returns the query string value from the current URL for the argument name
alink
returns a hyperlink
checkbox
returns a checkbox input
radio
returns a radio button input
inputtext
returns a text input field
inputsearch
returns a search input field
button
returns a normal button
togglebutton
returns a button that toggles/cycles between states
article
returns a boxed out article
breadcrumb(crumbs)
returns breadcrumbs for page navigation
crumbs
array of objects withhref
andtitle
properties.
reveal
returns a control that has a button to horizontally expand and collaps controls
wraplist
returns an element that wraps an array of items
select
returns an select box input
tree
returns an expanding tree of content
table
returns a table of data
unorderedlist
returns an unordered list (ul)
orderedlist
returns an ordered list (ol)
listitem
returns a list item to go inside an orderedlist or unorderedlist
listadd
Adds an item to an orderedlist or unorderedlist
element
returns a DOM element with a specific tagname
from options.
util
Provides a series of convenient utility functions:
isArray
test if object is an arrayisFunction
test if object is a functiontextism
convert markdown style content to HTMLaddCssClass
add a CSS class to a DOM elementremoveCssClass
remove a CSS class from a DOM elementforEachProperty
iterate over the properties of an object
None.
Copyright © 2019, Crown Copyright (Office for National Statistics)
Released under MIT license, see LICENSE for details.