JavaScript add-ons
Each JavaScript style includes a Correct use section. By adhering to the style's intended purpose(s), any future changes in the stylesheets will have predictable outcomes.
Table of contents
- Archiving content
- Auto-complete
- Calendar: Date picker
- Calendar: Events calendar
- Charts and graphs
- Expand/collapse
- Feedback
- Footnotes
- Form validation
- Light box
- Mathematical/scientific formula display
- Meter
- Multimedia
- Persistent storage
- Progress bar
- Share widget
- Slide out tab
- Source code
- Slider control
- Tabs / News sliders
- Text highlighting
- Web feeds
- Zebra striping
Archiving
Auto-complete
Add the auto-complete feature to a text input field.
Correct use
Refer to: Auto complete for text input fields wiki
Demo
Type in W for Winnipeg to see the auto-complete behaviour. This enhancement only works in modern browsers. Older browsers require the user to type out the info in full.
Calendar: Date picker
Calendar: Events calendar
Charts and graphs
Demo
food | auto | household | |
---|---|---|---|
Mary | 200 | 160 | 40 |
Tom | 3 | 40 | 30 |
Brad | 10 | 180 | 10 |
Kate | 40 | 80 | 90 |
View basic charts and graphs options
Expand/collaspe
Correct use
- Use to hide secondary or tertiary content, not primary content
- Do not use as a means to tidy up the look of your page. If the page is deemed too busy, consider other options like separating the content over several pages or chunking the information in a more aesthetically pleasing way.
- Refer to: Expand/collapse content wiki
- Refer to: Expand/collapse all content wiki
Feedback form
Footnotes
Form validation
Lightbox
Mathematical/scientific formula display
Demo
The quadratic equationMeter
Correct use
- The meter element represents a scalar measurement within a known range, or a fractional value; for example disk usage, the relevance of a query result, or the fraction of a voting population to have selected a particular candidate.
- This is also known as a gauge.
- The meter element should not be used to indicate progress (as in a progress bar). For that role, HTML provides a separate progress element.
- The meter element also does not represent a scalar value of arbitrary range — for example, it would be wrong to use this to report a weight, or height, unless there is a known maximum value.
Multimedia
Persistent storage
The HTML5 localStorage object is used to store data persistently (no expiration date). This component adds support for this object in browsers that do not already have native support.
Correct use
Refer to: Persistent storage wiki
Progress bar
Session timeout
Share widget
Slide out tab
Slider
Correct use
Not documented at this time.
Source code
Demo
<label for="data1">Form input default appearance:</label>
<input name="data1" type="text" id="data1" />
Tabs / News slider
An archive module can be added.
Correct use
Jakob Nielsen, a top usability expert, wrote the article Tabs, Used Right (external link), which outlines the correct use of tabs. In this document, he states that tabs should:
- Not use all-capital letters for the labels;
- Use only only one row of tabs that are on top of the panel;
- Alternate only between views within the same type of context, and not navigate to different areas;
- Tabs should logically chunk information so users can easily predict what they’ll find. They should not have to simultaneously refer to and compare content.
- Have a highlighted Currently selected tab — with unselected tabs that are clearly visible and readable;
- The Current tab should connect to the content area.
- Use plain language and have short titles;
- Use a parallel naming structure. Correct use = parallel labels: Incorrect use = unrelated labels:
- Have an obvious scope that the tabs control;
- Have a quick click response time (ideally <0.1 s).
- Refer to: Tabbed interface wiki
Demo
Tab 3
Tab 3 content. Tab 3 content. Tab 3 content. Tab 3 content.
Tab 4
Tab 4 content. Tab 4 content. Tab 4 content. Tab 4 content.
Text highlighting
Web feeds
Zebra striping
Demo
Header | Header |
---|---|
Data | Data |
Data | Data |
Data | Data |
Data | Data |
Data | Data |
View all zebra striping (column highlight) options
View all zebra striping (simple table) options
View all zebra striping (simple grouping table) options
View all zebra striping (invoice table) options
View all zebra striping (row level with summary table) options
- Date modified: