Skip to Main Content

Lists

Lists are used to present related content in a simple and scannable format.

Use when:

  • You want to communicate ordered steps to a user.
  • You want to break down important content in a way that’s easy for users to digest.

Interactive component

Race Result

  • Maximum amount: $999.99
  • Fee per money order: $7.50
  • Lists should align with surrounding text.

Race Result

  1. Maximum amount: $999.99
  2. Fee per money order: $7.50
  3. Lists should align with surrounding text.

Code Samples

Basic

Note that this component may require additional styling.

Angular

<mat-list> is a container component that wraps and formats a series of line items. As the base list component, it provides Material Design styling, but no behavior of its own.

Note that this component may require additional styling.



Mendix

Lists are out-of-the-box functionality.

You simply need to select the Navigation list from the toolbox on the right.

There are two styles that you can add to your lists. Under the Appearance tab of the widget, find the Class field and specify “unordered” for a bulleted list or “ordered” for a numbered list.

The Mendix toolkit can be found here.

Library integration

Use the codes below to add this component to your project. Download the latest version of the library to easily implement our full range of components.

Angular

Step 1. Install

Execute the following command to install this component.

npm i [NPM-PLACE-HOLDER]/ds-lists

Step 2. Import

Import the following into your app.module.ts file.

import { DsListsModule } from 'ds-lists';
List
<cpc-ds-lists
     heading="Ordered checklist"
     [lists]='[{ text: "Vehicula Magnaaa" }, { text: "ABC" }, { text: "Proin tincidunt, neque sed consequat blandit" }]'>
</cpc-ds-lists>
Unordred List
<cpc-ds-lists 
    heading="Unordered checklist" 
    [lists]='listObject'
    listType="unordered">
</cpc-ds-lists>
Properties
Name Type Default Description
heading string  

The list’s heading

lists any  

for eg:- [{ text: "Vehicula Magnaaa" }, { text: "ABC" }, { text: "Proin tincidunt, neque sed consequat blandit" }]

listType string ordered

Two types of lists: ordered and unordered

HTML

Step 1: Import CSS

Import the following into your theme or page.

<link type="text/css" href="[CSS-PLACE-HOLDER]" rel="stylesheet">

Step 2: Import JS

Import the following into your theme or page.

<script src="[JS-PLACE-HOLDER]"></script> 

Code snippets

unordered list
<!-- Unordered lists --> 
<p class="lists" id="list1">Race Result</p> 
<ul aria-labelledby="list1"> 
<li>Vehicula Magna</li> 
<li>Pharetra Vulputate Euismod</li> 
<li>Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit</li> 
</ul>
ordered list
<p class="lists" id="list2">Race Result</p> 
<ol aria-labelledby="list2"> 
<li>Vehicula Magna</li>
<li>Pharetra Vulputate Euismod</li> 
<li>Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit</li>
</ol>

General guidelines

Types of lists

There are two types of lists:

Unordered (bulleted) lists and Ordered (numbered) lists.

Both list types also support ‘nesting’.

Unordered lists

Unordered lists use bullet-points to group items.

Unordered lists

Ordered lists

Ordered lists use numbers to group items in a specific order.

Ordered lists

Positioning

Lists are left-justified. If they appear among other content (e.g. under a paragraph) they should be aligned underneath, indented once.

Nested lists (lists within lists) are aligned underneath parent list items, indented once. Make sure to change bullet point/number type to ease list navigation.

  • Nested lists are difficult to read, especially across multiple devices where formatting may get altered. Work with your content writer to find alternatives to nested lists.

Formatting

Don’t let lists get too long. Work with your content writer to find alternatives to long lists that avoid overwhelming your user. Consider:

  • 'Chunking' items into multiple lists.
  • Using tables instead of lists (useful for comparing products/services).
  • Using dropdowns to reduce cognitive load.

General guidelines

Keep the copy in bulleted and numbered lists grammatically parallel. Each list item should use consistent styling, starting with the same part of speech.

If you have 2 or more bullets with similar structures, rewrite the introduction to include the shared content. This allows for shorter list items.

  Guidelines Examples
Recommended length Use as needed to complete the thought but keep it as concise as possible
  1. Sign up. It’s free!
  2. Get your API keys.
  3. Integrate our services immediately.
  4. Test your application and go live.
Line wrap Minimize but not recommended; bullet text should wrap under itself and not under the bullet
  • Sign
  • Seal
  • Deliver
Phrasing Choose whether your list items will be complete sentences or fragments and stick to this convention
  • Sign your name legibly on the envelope
Case Sentence case; lists made up of fragments don’t require punctuation at the end
  • Sign in to your Canada Post account

Dos and don’ts

Upper and lower case

Use sentence case. It helps with legibility.

  • Write the destination address legibly.
  • Write The Destination Address Legibly

Information architecture

Keep the copy short for each list item so it’s clear and not cluttered.

  • Track package
  • Sign in to
    track the package

Format

You might want to use a table instead of a list as alternative, especially if you need to sort or compare items.

  • 1. Sign in to your Canada Post account
    2. Enter your postal code
    3. Click on Track
  • Sign in to your Canada Post account, enter your postal code, click on Track

Accessibility considerations

Screen readers detect unordered lists, but do not usually distinguish the levels of indentation. If you find yourself using nested lists, use a different bulleting/numbering system in the primary and secondary levels to help users with screen readers distinguish between them.

Ensure that unordered lists use the correct <ul> tags and ordered lists use the correct <ol> tags to help screen readers navigate the list structure as a group of related elements.

Design specs

Unordered lists

Unordered lists

Ordered lists

Ordered lists

Guidelines

Nested lists

The sub-list for a list item can be presented as a nested list. The developer must code a nested list so that the sub-list is between the opening and closing tags of its parent list item.

List labels

Providing a list label can be useful for screen reader users — especially when there are many lists on the page or the list represents quick steps.

Please note: Labelling lists is a good practice but be careful with the length of the label. Labels shouldn't be more than 3 to 5 words and should be clear and descriptive. Using lengthy list labels can be more frustrating than not using them. It’s not necessary to use labels for all lists.

The list can be labelled in three ways:

Option 1

Using aria-labelledby when the label is visible on the page. aria-labelledby will sit on the list element or and has the value of the ID of the element containing the visible label.

Option 2

Using aria-label when the label isn't visible on the page. aria-label will sit on the list element or and has the string value representing the label.

Option 2

Using the title attribute when the label isn't visible on the page. The title attribute will sit on the list element (<ul> or <ol>) and will have a string value representing the label. The title attribute approach isn’t recommended because the attribute comes last in the accessible name calculation for an element. If one of aria-labelledby or aria-label is present on the list, then the title attribute would provide an accessible description.

Hiding bullets

Bullets or numbers may be hidden from lists for aesthetic reasons. This isn't a problem, but screen reader users still need to perceive the logical grouping. As a result, list semantics must be maintained.

Whenever bullets or numbers are hidden, add role=list to the list element (<ul> or <ol>). This ensures all assistive technologies keep the list semantics. Some assistive technologies ignore the semantic information when the bullets are removed.

Table of contents lists

When designing a table of contents as a list, put a visible heading before the list of links. Associate the heading with the list using an aria-labelledby attribute on the list element (<ul> or <ol>). The whole component can also be enclosed in a navigation region, depending on the context. For example, the HTML nav element or role=navigation on a div.

Testing

When testing a list, the tester must ensure:

  • The list has the role of “list”.
  • The screen reader announces the role with the number of list items.
  • The number of list items announced matches the number of visible list items. Nested lists shouldn’t be counted as list items.
  • The screen reader announces if a label is associated with a list while interacting with the list.
  • Semantics are maintained even when the bullets or numbers are hidden. role=list should be present on the list element (<ul> or <ol>) if the bullets or numbers are hidden.

Related content