CSS Components
Icons
How to use
Icons indicate that the user can take an action, or they direct attention to an area or message. Use icons to convey conventional meanings and associations. If an icon isn’t universally known it should be accompanied by text to provide clarity.
Icons’ class names describe their usage or associated action. For icons performing the function of a button, the best practice is to present the icon with accompanying text, within a button appearance. The button appearance helps indicate that the element can be tapped to take an action, and the text clarifies what that action is.
Color
Financial Institutions can choose a link/icon color with a branding tool. To retain a visual contrast level consistent with the default design of Online Banking, the selected colors must meet level AA of WCAG 2.0. This site offers a way to test and adjust colors: http://snook.ca/technical/colour_contrast/colour.html
If the Financial Institution has not selected a link/icon color, then the icon must use one of the HEX values
below to meet accessibility guidelines:
#333333, #666666, or #FFFFFF (if on a dark background).
SVG Icons
These SVG icons should be displayed in default colors or Financial Institution’s link/icon color.
- accounts
- add
- alert-fill
- alert-outline
- arrow
- back
- bill-pay
- calendar
- call
- check-image
- check-mark
- computer
- delete
- down
- edit
- forward
- generic
- help
- help-outline
- hide
- info
- notifications
- order
- pay-people
- recycle
- refresh
- rename
- repeat
- rewards
- search
- security
- settings
- show
- sort
- stop-payment
- text
- text-mobile-alerts
- text-mobile-alerts-outline
- transfer-money
- up
The icons shown below should not be modified to another color.
- alert-error
- alert-warning
- turbo-tax
- scheduled
- success
- page-loader
- small-loader
- close
A yellow color indicates warning; “pay attention”.
Green indicates success.
Red indicates error.
Icons Size
There are three defined icon sizes: small, medium and large. You can adjust the SVG size if necessary to meet specific design goals.
- Small (sm)
- Default
- Large (lg)
16px X 16px
(field level messages)
1 em
(most common use)
32px X 32px
(not common)
Importing the SVG sprite
In order to use SVG icons that we provide, our SVG icon sprite file must be loaded. You can do this by adding the following to your HTML page:
<script src="https://resource.digitalinsight.com/leapfrog/[version]/js/load-svg.min.js"></script>
<script>loadSVG('https://resource.digitalinsight.com/leapfrog/[version]/img/svg/icons.svg');</script>
Note that you can call loadSVG()
whenever you want, so long as it's after the
load-svg
script has been loaded. Ideally it should be called before the page is
rendered, otherwise users may see a flash of no icons.
Using the icons
You can use the icons by creating an <svg>
tag with a <use>
tag inside inside of it. The xlink:href
attribute of the <use>
tag should be set to the name of the icon, preceded by a hash. See the design tab for a list of
available icons, as well as what names to use for which icons.
Example
This is an example of how to use SVG icons.
<svg role="img" class="di-svg" aria-labelledby="infoIconTitle1">
<title id="infoIconTitle1">Info Icon</title>
<use xlink:href="#info"></use>
</svg>
This is an example of how to use SVG icons.
By default, the size of the icon will increase with the font size. If you want to keep
the size of the icon constant, you can use the sm
and lg
classes.
They will set the size of the icon to be 16px or 32px, respectively. In the example below, the
first two icons are the same size because the font size happens to be 16px.
Example
An example of icon sizes.
<svg role="img" class="di-svg sm" aria-labelledby="infoIconTitle2">
<title id="infoIconTitle2">Info Icon</title>
<use xlink:href="#info"></use>
</svg>
<svg role="img" class="di-svg" aria-labelledby="infoIconTitle3">
<title id="infoIconTitle3">Info Icon</title>
<use xlink:href="#info"></use>
</svg>
<svg role="img" class="di-svg lg" aria-labelledby="infoIconTitle4">
<title id="infoIconTitle4">Info Icon</title>
<use xlink:href="#info"></use>
</svg>
An example of icon sizes.
For loaders, you will need to add the rotate
class in order to get them to spin.
Example
Loading...
<svg role="img" class="di-svg rotate" aria-labelledby="loaderIconTitle1">
<title id="loaderIconTitle1">Small Loading Icon</title>
<use xlink:href="#small-loader"></use>
</svg>
Loading...
Accessibility
In order for your icons to be fully accessible, you should make sure to follow these guidelines:
-
Add the
role="img"
attribute to the<svg>
tag. -
Provide a
<title>
as the first child of the<svg>
and give it a unique id. -
Include a
<desc>
as the next child if your usage of the icon would benefit from one. Give it a unique id as well. -
Add an
aria-labelledby
attribute to the<svg>
tag with the value set to the ids of the<title>
and<desc>
(if present) tags.
Example
Fees: $1.23
Fees: $1.23
<a href="javascript:void(0);">
<svg role="img" class="di-svg" aria-labelledby="infoIconTitle5 infoIconDescription5">
<title id="infoIconTitle5">Help Icon</title>
<desc id="infoIconDescription5">Click to learn more about how fees are calculated</desc>
<use xlink:href="#help"></use>
</svg>
</a>
Messaging and Notifications
Visual Specifications
There are four types of page-level messages: Error, Warning, Success, and Informational.
Messages typically remain on screen until the user navigates away from or refreshes the page. If the user continues to interact with the form after successful completion of an action, it may be necessary to have the message disappear after five seconds.
The most common placement for these types of messages is 20px below the line, under the main heading.
If the form is very long, the message can be placed directly above the buttons so the user can view the message without having to scroll to the top.
L, M, S
XS
Other types of messages and notifications
Information unavailable, warning, or zero data state
Overlay messaging
L, M, S
XS
Examples
Page level message or notification example
Information unavailable
Loading
Page failure on loading
<div class="media alert alert-{success | info | danger | warning | message}">
<div class="media-left"></div>
<div class="media-body">
<strong>Hightlight!</strong> You can provide detail message here.
</div>
</div>
Alerts Without Icons
<div class="media alert alert-{success | info | danger | warning | message}">
<div class="media-body">
<strong>Hightlight!</strong> You can provide detail message here.
</div>
</div>
Messages
<div class="media message message-{success | info | danger | warning }">
<div class="media-left"></div>
<div class="media-body">
<strong>Hightlight!</strong> You can provide detail message here.
</div>
</div>
Drop Down
Visual Specifications
There are two sizes for drop downs: default and small. The use of each depends on size constraints on the page. The only items that change between the default and small size drop downs are the height and the font size.
Main drop down style (over white background)
Icons and text are centered vertically. Text: Arial 16px, #333333
Main drop down style (over gray background)
Variation
Dropdown toggle as a link
Font size is determined by hierarchy and the space on the page.
The font color is the financial institution’s primary accent color. The drop-down arrow is provided as a vector image in the icons file. Please add the financial institution’s color to that file and save it as a .png.
If the financial institution’s primary color is not available, the default text color is #333333.
Complex Dropdown menu
Dropdown menu can have addtional information pertaining to the item shown below it.
Each row is separated by a line.
Example shows the component for account balances and any addtional information required.
All fonts & paddings stay the same independent of screen size. Please note that the VERTICAL padding specs indicate padding in CSS (not the typical padding as measured between text). This is in order to take in account line height.
Dropdown menu with headers
Used when the menu options in the dropdown need some sort of logical grouping
Headers cannot be selected. They are just titles.
The header background color takes the FI branding color A at 10%.
Dropdown menu with footer
Typically has a action show as a link. eg: Allowing user to add item to the list or manage the list etc.
Label name needs to reflect the action the user will take. E.g.: Add a new payee or Add an account or Manage categories etc.
Clicking on the link it will close the dropdown menu and trigger the action.
Scrolling the list will not scroll the footer. It is fixed at the bottom.
Icon to the left of the link is optional.
Factors That Effect Drop Down Width
Large, Med, Small
The width of the control is determined by the the location of the drop-down on the form. The minimum width of the drop-down is set by the size of the control. The drop-down control should not change its width, however there are a few use cases where the text in the control needs to be truncated or ellipsed depending on content.
Ideally the control and drop-down would remain the same width as the control; longer options will wrap in the row.
Exception to these rules: the drop down can be wider than the control width if the space is available - in this case the designer will need to set a max width for the large, med, and small breakpoints.
XS Design
The control is a tappable row, and the drop-down menu becomes a slide panel. The same rules regarding truncation on the control and wrapping on the menu apply to the XS breakpoint.
Exception to these rules: Avoid slide panels on top of slide panels in the design. In complex forms when there are many form elements, you may need to use the same drop-down control and menu that is used in the LG, MD, and S breakpoints.
Accessibility
All images must have an alt attribute (even if the function of the image is purely decorative and alt=“”). When an image has meaning to a sighted user, convey this with the alt attribute if possible. Avoid images that contain text; if they do, the alt value must contain the same string of text.
- on-gray | link: optional, variation support look like link or on Gray background.
- sm: optional, if want to have small version
- active: optional, if want to have list item selected state.
- disabled: optional, if disabled the control is required.
<div class="di dropdown {on-gray | link | fi link} {sm}">
<button class="toggle" id="dLabel1" type="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false" title="Select One ...">
<span class="ddlabel">Select One ...</span><span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel1">
<li class="{active}"><span>List Option 1</span></li>
<li><span>List Option 2</span></li>
</ul>
</div>
Toggle
Visual Specifications
- Toggles are used for an option that the user can turn on or off. For example, Yes/No or On/Off. Usually a label is associated with this element which is placed to the left or top of it.
- There are two sizes for toggles: small and large. The use of each depends on the size constraints of the page.
- The selected color for the toggle when turned “ON” is the financial institution’s primary accent color, if this color information is not available then the default color is #666666. Details are covered in the Branding section.
- Use the default browser focus state.
Hover & Disabled States
When the inset area of the toggle button is hovered:
When the switch is hovered:
When the toggle switch is disabled:
Transition
The switch transition duration from side to side is 0.3s, easeOutQuint.
The background color fades between the ON/YES background color and the OFF/NO background color over the period of the transition.
Accessibility
- The element acting as a toggle button should be focusable and selectable with the keyboard.
- It must have role defined, so that it is announced to assistive technology.
- ARIA-checked needs the right state (true or false), so it is announced when the state changes.
- When assistive technology is announcing the element, it should already read out the label/action associated with it. For example, “Turn on eBills” OR “Need ACH Payments - Yes. Click to say No”
Default
Small
- sm: optional, for small version
- active: optional, sets the switch to On/Yes state.
- disabled: optional, disables the control.
<div class='di-toggle-switch-container {sm}'>
<div class='di-toggle-switch {active} {disabled}'>
<span class='label-on '>ON</span>
<span class='label-slider' > </span>
<span class='label-off '>OFF</span>
</div>
</div>
Checkbox
Visual Specifications
There are two sizes for check boxes: small and large. The use of each depends on the size constraints of the page.
Checkboxes are used when there are lists of options and the user may select any number of choices, including none, one, or several. In other words, each checkbox is independent of all other checkboxes on the list, so checking one box does not uncheck the others. A stand-alone checkbox can be used for a single option that the user can turn on or off.
Use the default browser focus state.
Padding between checkbox and its label will be 10px for XS and 15px for other break points.
If there are two or more consecutive check boxes then the padding between them will be 30px
Accessibility
To attain the correct styling:
- The element acting as a checkbox should be focusable and selectable with the keyboard
- It must have role=“checkbox”, so that it is announced to assistive technology as a checkbox
- Aria-checked needs the right state (true or false), so it is announced when the state changes
Additional information:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/
Using_the_checkbox_role
http://webaim.org/techniques/forms/controls#checkbox
- sm: optional, if want to have small version
- disabled: optional, if disabled the control is required.
<label class="di-radio">
<input type="radio" name='radioFoo' {disabled}/>
<span class="lbl {sm}"> Radio Foo Label</span>
</label>
Small
- sm: optional, if want to have small version
- disabled: optional, if disabled the control is required.
<label class="di-checkbox">
<input type="checkbox" name='checkboxFoo' {disabled}/>
<span class="lbl {sm}"> Check Box Foo Label</span>
</label>
Modal
Visual Specifications
Modal dialogs are used when the user must take or confirm an action. The interface limits interaction to either completing or canceling the current task. Use modal dialogs sparingly for critical tasks or confirming irreversible actions. Using the full screen is preferable to an overlay at the XS size, as an overlay may cause scrolling issues on mobile devices.
Modal is horizontally centered in the viewport, and positioned 20px below the top of the viewport. If displayed within an iframe, it is 20px from the top of the iframe.
Screen size | Default Padding |
Large | 30 px, 30px, 40px, 30px |
Medium | 30 px, 30px, 40px, 30px |
Small | 20 px, 20px, 30px, 20px |
Example
Accessibility
- Modals: On close, return focus to the element that activated the overlay.
- Close buttons: Images that function as a button (such as an image of an “X” to represent “Close”) must include a text equivalent. If the text equivalent is hidden from view, it must remain available for assistive technology (e.g. using text-indent to move it off screen). If it’s an img element acting as a button, it also needs an ARIA role.
- All WAI-ARIA enabled dialog boxes should be modal. A modal dialog prevents the user from setting the focus outside of the dialog until the dialog is closed. Mouse clicks outside of the dialog must be ignored, and the user must not be able to tab into or out of the dialog itself.
- All images must have an alt attribute (even if the function of the image is purely decorative and alt=“”). When an image has meaning to a sighted user, convey this with the alt attribute if possible. Avoid images that contain text; if they do, the alt value must contain the same string of text.
- Indicate: Focus; the easiest way to achieve this is to not remove default styling for the outline property.
Modal Overlay Examples
<div class="modal fade" id="modalExample2" tabindex="-1" role="dialog" aria-labelledby="modalExample2">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h2 class="modal-title">Heading</h2>
</div>
<div class="modal-body">
<div class="di-callout xs-void">
<h2>Subheading Arial 18px #333333</h2>
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </span>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">OK</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
Date Picker
Visual Specifications
The calendar can open in any direction depending on the screen space. While the calendar is open, focus should be restricted within the calendar. Date select should occur with the use of the enter button or the spacebar.
The user can type in the date or use the calendar to select the date. They should be able to type in 08-22-16, or 08/22/16, or 08/22/2016. On blur, the format should automatically change to mm/dd/yy.
If they have chosen a language where the day is listed first, then the format should read dd/mm/yy.
If today’s date is selected, it should be green with the financial institution’s color as a line around the green.
Accessibility
- Indicate: Focus; the easiest way to achieve this is to not remove the default styling for the outline property.
- All images must have an alt attribute (even if the function of the image is purely decorative and alt=“”). When an image has meaning to a sighted user, convey this with the alt attribute if possible. Avoid images that contain text; if they do, the alt value must contain the same string of text.
- On close, return the focus to the element that activated the calendar.
- Close buttons: Images that function as a button (such as an image of an “X” to represent “Close”) include a text equivalent. If the text equivalent is hidden from view, it must remain available for assistive technology (e.g. using text-indent to move it off screen). If it’s an img element acting as a button, it also needs a ARIA role
Select Date
« | January 2017 | » | ||||
---|---|---|---|---|---|---|
S | M | T | W | T | F | S |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 | 1 | 2 | 3 | 4 |
<!-- Datepicker Start -->
<div class="span4 col-md-4 datepicker-container">
<div class="top">
<div class="section heading">
<h3>Select Date</h3>
</div>
<div tabindex="0" class="section close">
<span id="Close" class="di-svg" aria-labelledby="Close" style="fill: currentcolor; display: inline-block; width: 15px;">
<svg x="0px" y="0px" viewBox="0 0 18 18" enable-background="new 0 0 18 18" focusable="false">
<title></title><desc></desc>
<g>
<polygon points="18,2.5 15.5,0 9,6.5 2.5,0 0,2.5 6.5,9 0,15.5 2.5,18 9,11.5 15.5,18 18,15.5 11.5,9 "></polygon>
</g>
</svg>
</span>
</div>
</div>
<div>
<div class="datepicker">
<!-- <div class="datepicker datepicker-inline"> -->
<div class="datepicker-days" style="display: block;">
<table class="table table-condensed">
<thead>
<tr>
<th colspan="7" class="datepicker-title" style="display: none;"></th>
</tr>
<tr>
<th class="prev" style="visibility: visible;">«</th>
<th colspan="5" class="datepicker-switch">January 2017</th>
<th class="next" style="visibility: visible;">»</th>
</tr>
<tr>
<th class="dow disabled">S</th>
<th class="dow">M</th>
<th class="dow">T</th>
<th class="dow">W</th>
<th class="dow">T</th>
<th class="dow">F</th>
<th class="dow">S</th>
</tr>
</thead>
<tbody>
<tr>
<td class="day highlighted disabled-date disabled old">25</td>
<td class="day old">26</td>
<td class="day old">27</td>
<td class="day old">28</td>
<td class="day old">29</td>
<td class="day old">30</td>
<td class="day highlighted old">31</td>
</tr>
<tr>
<td class="day highlighted disabled-date disabled">1</td>
<td class="day">2</td>
<td class="day">3</td>
<td class="day">4</td>
<td class="day">5</td>
<td class="day">6</td>
<td class="day highlighted">7</td>
</tr>
<tr>
<td class="day highlighted disabled-date disabled">8</td>
<td class="day">9</td>
<td class="day">10</td>
<td class="day">11</td>
<td class="day">12</td>
<td class="day">13</td>
<td class="day highlighted">14</td>
</tr>
<tr>
<td class="day highlighted disabled-date disabled">15</td>
<td class="day">16</td>
<td class="day">17</td>
<td class="day">18</td>
<td class="day">19</td>
<td class="day">20</td>
<td class="day highlighted">21</td>
</tr>
<tr>
<td class="day highlighted disabled-date disabled">22</td>
<td class="day">23</td>
<td class="day">24</td>
<td class="day">25</td>
<td class="day">26</td>
<td class="day">27</td>
<td class="day highlighted">28</td>
</tr>
<tr>
<td class="day highlighted disabled-date disabled">29</td>
<td class="day">30</td>
<td class="day">31</td>
<td class="day new">1</td>
<td class="day new">2</td>
<td class="day new">3</td>
<td class="day highlighted new">4</td>
</tr>
</tbody>
<tfoot>
<tr>
<th colspan="7" class="today" style="display: none;">Today</th>
</tr>
<tr>
<th colspan="7" class="clear" style="display: none;">Clear</th>
</tr>
</tfoot>
</table>
</div>
<div class="datepicker-months" style="display: none;">
<table class="table table-condensed">
<thead>
<tr>
<th colspan="7" class="datepicker-title" style="display: none;"></th>
</tr>
<tr>
<th class="prev" style="visibility: visible;">«</th>
<th colspan="5" class="datepicker-switch">2017</th>
<th class="next" style="visibility: visible;">»</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="7">
<span class="month focused">Jan</span>
<span class="month">Feb</span>
<span class="month">Mar</span>
<span class="month">Apr</span>
<span class="month">May</span>
<span class="month">Jun</span>
<span class="month">Jul</span>
<span class="month">Aug</span>
<span class="month">Sep</span>
<span class="month">Oct</span>
<span class="month">Nov</span>
<span class="month">Dec</span></td>
</tr>
</tbody>
<tfoot>
<tr>
<th colspan="7" class="today" style="display: none;">Today</th>
</tr>
<tr>
<th colspan="7" class="clear" style="display: none;">Clear</th>
</tr>
</tfoot>
</table>
</div>
<div class="datepicker-years" style="display: none;">
<table class="table table-condensed">
<thead>
<tr>
<th colspan="7" class="datepicker-title" style="display: none;"></th>
</tr>
<tr>
<th class="prev" style="visibility: visible;">«</th>
<th colspan="5" class="datepicker-switch">2010-2019</th>
<th class="next" style="visibility: visible;">»</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="7">
<span class="year old">2009</span>
<span class="year">2010</span>
<span class="year">2011</span>
<span class="year">2012</span>
<span class="year">2013</span>
<span class="year">2014</span>
<span class="year">2015</span>
<span class="year">2016</span>
<span class="year focused">2017</span>
<span class="year">2018</span>
<span class="year">2019</span>
<span class="year new">2020</span></td>
</tr>
</tbody>
<tfoot>
<tr>
<th colspan="7" class="today" style="display: none;">Today</th>
</tr>
<tr>
<th colspan="7" class="clear" style="display: none;">Clear</th>
</tr>
</tfoot>
</table>
</div>
<div class="datepicker-decades" style="display: none;">
<table class="table table-condensed">
<thead>
<tr>
<th colspan="7" class="datepicker-title" style="display: none;"></th>
</tr>
<tr>
<th class="prev" style="visibility: visible;">«</th>
<th colspan="5" class="datepicker-switch">2000-2090</th>
<th class="next" style="visibility: visible;">»</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="7"><span class="decade old">1990</span><span class="decade">2000</span><span class="decade">2010</span><span class="decade">2020</span><span class="decade">2030</span><span class="decade">2040</span><span class="decade">2050</span><span class="decade">2060</span><span class="decade">2070</span><span class="decade">2080</span><span class="decade">2090</span><span class="decade new">2100</span></td>
</tr>
</tbody>
<tfoot>
<tr>
<th colspan="7" class="today" style="display: none;">Today</th>
</tr>
<tr>
<th colspan="7" class="clear" style="display: none;">Clear</th>
</tr>
</tfoot>
</table>
</div>
<div class="datepicker-centuries" style="display: none;">
<table class="table table-condensed">
<thead>
<tr>
<th colspan="7" class="datepicker-title" style="display: none;"></th>
</tr>
<tr>
<th class="prev" style="visibility: visible;">«</th>
<th colspan="5" class="datepicker-switch">2000-2900</th>
<th class="next" style="visibility: visible;">»</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="7">
<span class="century old">1900</span>
<span class="century">2000</span>
<span class="century">2100</span>
<span class="century">2200</span>
<span class="century">2300</span>
<span class="century">2400</span>
<span class="century">2500</span>
<span class="century">2600</span>
<span class="century">2700</span>
<span class="century">2800</span>
<span class="century">2900</span>
<span class="century new">3000</span>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th colspan="7" class="today" style="display: none;">Today</th>
</tr>
<tr>
<th colspan="7" class="clear" style="display: none;">Clear</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
<!-- Datepicker End -->
Callout
Visual Specifications
At Large, Medium, and Small sizes, callouts are used group content together. At the XS screen size the callout is removed to save space; however, there are exceptional instances where a callout is still needed at XS in order to group critical information together. For example, complex forms sometimes require a callout to persist at XS to help the user understand its hierarchy.
Screen size | Padding (Top, Right, Bottom, Left) from the edge of the container to the content. |
Large | 30px, 30px, 30px, 30px |
Medium | 30px, 30px, 30px, 30px |
Small | 20px, 20px, 20px, 20px |
XSmall | 20px, 20px, 20px, 20px *if there is a callout on XS (not default behavior) |
Examples
Simple form
L, M, S
XS
Overlay
L, M, S
XS
- xs-void: will omit padding and background color for XS breakpoint.
<div class="di-callout {xs-void}">
This is test Callout; behave normally for all break points except XS.
</div>
Input Fields
Input fields allow users to provide textual information to an interface. Typically input fields are labeled within a form and denote whether they are required or optional. Input fields have several possible states to convey validation specifics.
There are two input field sizes: default and small. Default has a 42px text box height. The small size is used for complex forms with space constraints, and has a 35px text box height. The font-size of input within the field is the same for both default and small.
States
Label placement
Preferred label placement is above the field. This accommodates narrow views, and minimizes form completion times. An alternative, when it's necessary to conserve vertical space, is to place right-aligned labels to the left of each field, but this arrangement is more difficult for users to scan than top-aligned labels.
Indicate whether a field is optional or required along with its label. Example: Label (optional).
- If all fields are required, you may specify that once within the form's instructions to alleviate the need to repeat information within each label.
- When there are both required and optional fields, identify whichever type is fewer. If there are more required fields than optional fields, annotate only the optional fields (or vice-versa).
Inline error placement
Specific input errors are identified with a red border, an additional outline, and an error message below the field. If there is a need to save vertical space then the error message can display to the right of the field.
Form completion best practices
- Use the fewest input fields possible to achieve the task
- Use smart defaults or demonstrative placeholder values
- When possible, use field length as an affordance (the width of a field helps the user anticipate its purpose).
- Use forgiving inputs (i.e. the multiple ways people format phone numbers)
- Use inline validation
- When possible, validate the field on “blur” when user clicks out of the field
Accessibility
- Indicate: Focus; the easiest way to achieve this is to not remove default styling for the outline property.
- Identify errors with more than color. Examples: fields in an error state have a thicker visual border in addition to the border being red; error messages use an icon and text color to indicate the error state.
- Validation:
- Error feedback within a form gets the alert role to provide the information immediately to the user. A role of alert is an assertive live region, meaning the message will be delivered to the user immediately.
- Required elements get the required attribute and aria-required=“true”; items that fail validation get aria-invalid=“true”.
- When identifying failed validation, consider placing :focus on the item that needs correction.
- One of the biggest failures with forms is not sending keyboard focus to the field with an error or the list of error messages; when this occurs the user may assume the form is broken. Using the alert role delivers the information immediately to assistive technology, so it’s not necessary to bring :focus to the alert node.
<div class="form-group">
<label>Default</label>
<input class="form-control input-xlg" type="text" placeholder="Placeholder text">
</div>
<div class="form-group">
<label>Small</label>
<input class="form-control input-xsm" type="text" placeholder="Placeholder text">
</div>
States
<div class="form-group">
<label>Normal</label>
<input class="form-control input-xlg input-default" type="text" placeholder="Placeholder text">
</div>
<div class="form-group">
<label>Focus</label>
<input class="form-control input-xlg input-focus" type="text" placeholder="Placeholder text">
</div>
Errors
Error Message
Warning Message
Success Message
Saving
<div class="form-group">
<input class="form-control input-xlg input-error" type="text" placeholder="Placeholder text">
<p class="help-block">
<span class="icon icon-sm-alert-error icon-sm-alert-error-dims" aria-hidden="true"></span>
Error Message
</p>
</div>
<div class="form-group">
<input class="form-control input-xlg input-warning" type="text" placeholder="Placeholder text">
<p class="help-block">
<span class="icon icon-sm-alert-warning icon-sm-alert-warning-dims" aria-hidden="true"></span>
Warning Message
</p>
</div>
<div class="form-group">
<input class="form-control input-xlg input-success" type="text" placeholder="Placeholder text">
<p class="help-block">
<span class="icon icon-sm-success icon-sm-success-dims" aria-hidden="true"></span>
Success Message
</p>
</div>
<div class="form-group">
<input class="form-control input-xlg input-saving" type="text" placeholder="Placeholder text">
<p class="help-block">
<span class="icon icon-sm-small-loader icon-sm-small-loader-dims" aria-hidden="true"></span>
Saving
</p>
</div>
Tooltips
Visual Specifications
A tooltip provides the user a brief contextual explanation for a control or feature. Tooltips allow information to be provided optionally, at the time of need.
- Tooltips are for supplemental information. They do not contain controls for critical actions.
- Use tooltips sparingly as they can cause usability issues on mobile devices. In the XS screen size, consider making the tooltip a full page.
- To view a tooltip, the user activates its help icon with a tap or click. To dismiss the tooltip, the user may hit the close corner icon or tap outside the tooltip box.
- The tooltip can be set to open to the right, below, left, or above the element that activates it.
- The tooltip’s fill is gray when it overlays a white background, and white when it appears against a gray background.
Example
Accessibility
- On close, return focus to the element that activated the tooltip.
- The element that activates a tooltip should have a text equivalent. If the text equivalent is hidden from view, it must remain available for assistive technology.
- Tool tips: need ARIA role "tooltip" and "aria-hidden" property. The element a tip pertains to needs the ARIA property "aria-describedby".
Help icons that activate with tool tips on click / tap
Default (over white background)
Variation (over gray background)
<h4> Default (over white background) </h4>
<a href="#" class="btn" data-container="body" data-toggle="popover" data-trigger="focus" data-placement="right" data-content="<div class='tip-icon'><h3>Why did I get this page?</h3><span>Common reasons include:</span><ul><li>You recently cleared your cookies <a href='#'>Learn more</a></li><li>You are browsing in private ir incognito mode</li><li>You are using a different browser from the one you set last time</li><li>You knowingly or unknowningly asked to skip this extra security step</li></ul></div>">
<span class="icon icon-sm-help icon-sm-help-dims"></span>
</a>
<h4> Variation (over gray background) </h4>
<a href="#" class="btn" data-container="body" data-toggle="popover" data-trigger="focus" data-placement="right" data-content="<div class='tip-icon'><h3>Why did I get this page?</h3><span>Common reasons include:</span><ul><li>You recently cleared your cookies <a href='#'>Learn more</a></li><li>You are browsing in private ir incognito mode</li><li>You are using a different browser from the one you set last time</li><li>You knowingly or unknowningly asked to skip this extra security step</li></ul></div>">
<div class="row tooltip-title"><span class="icon icon-sm-help icon-sm-help-dims icon-gap"></span> How do tool tips work?</div>
</a>
Tables
Design Guidelines
Tables display grids of information in rows and columns. Their layout and behavior should be tailored to the user's needs for viewing and interacting with the data.
Possible attributes/behaviors of table component
- sorting results by column
- searching/filtering of tabular data with input fields or drop downs
- pagination for large data sets
- highlight on table rows/cells
- loading, zero data, warning, and error states
- errors at the row and cell level
Basic Table
Main Heading
Cards | Type | Expiry on | Owned by | Amount | |
---|---|---|---|---|---|
My Visa Card *0987 | Visa | 03/14/2015 | Jordan Kennsington Smith | $12,000.00 | Cancel Card |
College Card *0987 | ATM | 12/14/2016 | John Smith | $9,789.00 | Cancel Card |
My Debit Card *0893 | Debit Card | 01/14/2015 | Molly Smith | $1,258.00 | Cancel Card |
<div class="page-header">
<h1>Main Heading</h1>
<div class="added-info">Additional Information</div>
</div>
<div class="row">
<div class="col-xs-12 table-responsive">
<table class="table">
<thead>
<tr>
<th>Cards</th>
<th>Type</th>
<th>Expiry on</th>
<th>Owned by</th>
<th class="text-right">Amount</th>
<th> </th>
</tr>
</thead>
<tbody>
<tr>
<td>My Visa Card *0987</td>
<td>Visa</td>
<td>03/14/2015</td>
<td>Jordan Kennsington Smith</td>
<td class="text-right">$12,000.00</td>
<td><a>Cancel Card</a></td>
</tr>
<tr>
<td>College Card *0987</td>
<td>ATM</td>
<td>12/14/2016</td>
<td>John Smith</td>
<td class="text-right">$9,789.00</td>
<td><a>Cancel Card</a></td>
</tr>
<tr>
<td>My Debit Card *0893</td>
<td>Debit Card</td>
<td>01/14/2015</td>
<td>Molly Smith</td>
<td class="text-right">$1,258.00</td>
<td><a>Cancel Card</a></td>
</tr>
</tbody>
</table>
</div>
</div>
Responsive Table
Main Heading
<div class="page-header">
<h1>Main Heading</h1>
<div class="added-info">Additional Information</div>
</div>
<div class="row">
<div class="col-xs-12"> </div>
</div>
<div class="di-rs-table">
<div class="row heading">
<!-- Table Heading -->
<div class="col-xs-3"><span class="cell first">Cards</span></div>
<div class="col-xs-2"><span class="cell">Type</span></div>
<div class="col-xs-2"><span class="cell">Expiry on</span></div>
<div class="col-xs-3"><span class="cell">Owned by</span></div>
<div class="col-xs-2"><span class="cell last"> </span></div>
</div>
<div class="row data">
<!-- Table Data Row -->
<div class="col-xs-3"><span class="cell first">My Visa Card *0987</span></div>
<div class="col-xs-2"><span class="cell">Visa</span></div>
<div class="col-xs-2"><span class="cell">03/14/2015</span></div>
<div class="col-xs-3"><span class="cell">Jordan Kennsington Smith</span></div>
<div class="col-xs-2"><span class="cell last"><a>Cancel Card</a></span></div>
</div>
<div class="row data">
<!-- Table Data Row -->
<div class="col-xs-3"><span class="cell first">College Card *0987</span></div>
<div class="col-xs-2"><span class="cell">ATM</span></div>
<div class="col-xs-2"><span class="cell">12/14/2016</span></div>
<div class="col-xs-3"><span class="cell">John Smith</span></div>
<div class="col-xs-2"><span class="cell last"><a>Cancel Card</a></span></div>
</div>
<div class="row data">
<!-- Table Data Row -->
<div class="col-xs-3"><span class="cell first">My Debit Card *0987</span></div>
<div class="col-xs-2"><span class="cell">Debit Card</span></div>
<div class="col-xs-2"><span class="cell">01/14/201</span></div>
<div class="col-xs-3"><span class="cell">Molly Smith</span></div>
<div class="col-xs-2"><span class="cell last"><a>Cancel Card</a></span></div>
</div>
</div>
Tabs
The Tab Container is styled similarly to Primary and Secondary containers, but additionally supports tabbed sections so the user may control which content displays within the container. Tab Container’s content area uses the same values for padding as Primary Container.
Visual Specifications
Small, Medium, Large
XSmall
Screen size | Padding for left and right of tabs |
---|---|
Large | 30px |
Medium | 30px |
Small | 20px |
XS | 20px |
Tab Container
Tabs
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
<div id="exTab1" class="tab-container">
<ul class="nav nav-pills">
<li class="active xtab">
<a href="#1a" data-toggle="tab">Tab 1</a></li>
<li class="xtab"><a href="#2a" data-toggle="tab">Tab 2</a></li>
<li class="xtab"><a href="#3a" data-toggle="tab">Tab 3</a></li>
</ul>
<div class="tab-content clearfix">
<div class="tab-pane active" id="1a">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</div>
<div class="tab-pane" id="2a">
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<div class="tab-pane" id="3a">
<p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>