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.

Archiving

Indicate that a page has been archived.

Correct use

Refer to: Archiving content wiki

Demo

No demo provided here.

View all archived options

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.

View all auto-complete options

Calendar: Date picker

Correct use

Refer to: Date picker wiki

Demo

View all date picker options

Calendar: Events calendar

Correct use

Refer to: Events calendar wiki

Demo

  1. Single-Day Event

    Event Description

View all events calendar options

Charts and graphs

Correct use

Refer to: Charts and graphs wiki

Demo

2009 Individual Sales by Category
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

View custom charts and graphs options

View complex 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

Correct use

Refer to: Feedback form wiki

Demo

This is a Government of Canada specific product solution.

View the feedback form

Footnotes

Correct use

Refer to: Footnotes wiki

Demo

Paragraph of information goes here.Footnote 1.

Footnotes

Footnote 1

Footnote go here.

Return to footnote 1 referrer

View all footnotes options

Form validation

Correct use

Refer to: Form validation wiki

Demo

Too complex to demo here.

View all form validation options

Correct use

Refer to: Light box wiki

Demo

Inline content

Inline content goes here

View all lightbox display options

Mathematical/scientific formula display

Demo

The quadratic equation a x 2 + b x + c = 0

View all mathematical/scientific formula display options

Meter

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.

Demo

75% (normal)

View all meter options

Multimedia

Correct use

Refer to: Multimedia player wiki

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

Demo

No demo provided here.

View all local storage options

Progress bar

Correct use

Refer to: Progress bar wiki

Session timeout

Correct use

Refer to: Session timeout wiki

Demo

Too complex to demo here.

View all session timeout options

Share widget

Correct use

Refer to: Share widget wiki

Slide out tab

Correct use

Refer to: Slide out tab wiki

Demo

Too complex to demo here.

View all slide out tab options

Slider

Correct use

Not documented at this time.

Demo

Range: 0 to 100 in steps of 1

View all slider options

Source code

Correct use

Refer to: Prettify source code wiki

Demo

<label for="data1">Form input default appearance:</label>
<input name="data1" type="text" id="data1" />
	

View all source code options

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 1 content

Tab 2 content

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.

View all tab and news slider options

Text highlighting

Correct use

Refer to: Text highlighting wiki

Demo

Too complex to demo here.

View all slide out tab options

Web feeds

Correct use

Refer to: Web feeds wiki

Zebra striping

Correct use

Refer to: Zebra striping wiki