Groups related content items together either vertically or horizontally
Collect items to be displayed in a list when items are not marked with bullets. This is the default and is also known as unordered and undecorated “bare” list.
Collect related items that don’t need to be in a specific order or sequence. List items are typically marked with bullets.
Collect related items with numeric order or sequence. Numbering starts at 1 with the first list item and increases by increments of 1 for each successive ordered list item.
Compact modifier can be added to any cdr-list
in order to reduce the margin between list items.
Display items horizontally with no divider.
Display items horizontally, separated by a bullet character.
To ensure that usage of this component complies with accessibility guidelines:
When creating nested lists, ensure they are coded properly. Always check that:
<ol>
or <ul>
This component has compliance with WCAG guidelines by:
Break up chunks of content to make the information easier to scan:
Use multi-column lists when:
Every item in a list must:
WebAIM: Semantic Structure: Using Lists Correctly (opens new window)
This component will bind any attribute that a native HTML list element (opens new window) accepts (with exception of type
attribute for ordered lists, use the list-style-type
CSS property instead).
tag
name
string
type
'ul'
default
Sets valid HTML element tag. Possible values: { ‘ul’ | ‘ol’ }
modifier
name
string
type
N/A
default
Modifies the style variant for this component. Possible values: { ‘ordered’ | ‘unordered’ | ‘compact’ | ‘inline’ }
Find more information about using Slots in the article Installing Cedar.
default
name
Sets the innerHTML for CdrList. This includes text and html markup.
Visual style and semantic meaning are managed independently by providing:
tag
propmodifier
propBy default the CdrList component renders as an unordered and undecorated "bare" list. To use an ordered list, pass <ol>
to the tag property.
<cdr-list tag="ol">
<li> item one </li>
<li> item two </li>
</cdr-list>
The CdrList component has decoupled the semantic tags <ul>
and <ol>
from visual presentation.
It is possible to render a semantic ordered list <ol>
as a visually non-styled or bulleted list using the cdr-list
modifiers. With this decoupling, individual list items can contain a variety of HTML elements, including paragraphs, headings, form elements, and other (nested) lists. Ensure that content is structured and follows design guidelines.
Following are different types of lists:
<ul>
element and multiple list item <li>
elements<ol>
element and multiple list item <li>
elementscdr-list
can be nested into another list<cdr-list>
<li> Unordered list item text
<cdr-list tag="ol">
<li>Ordered list item text</li>
</cdr-list>
</li>
</cdr-list>
Note that the tag itself does not determine display, a modifier must be added for list styles. Add one of the following variants to the modifier
attribute of the cdr-list
tag to change the visual presentation:
Value | Description |
---|---|
'unordered' | List items are typically marked with bullets |
'ordered' | List items are typically marked with numbers |
'compact' | Reduces spacing between list items |
'inline' | List items appear horizontally with no divider |