Components / Feedback and display
List
A real list (ul or ol) with drawn markers: bullets, numbered how-to steps, a ticked feature list, or an icon per item. Each item has a label and an optional description under it. For long-form text with lists inside, use Prose; for progress through a flow, use Steps.
When to useLink to "When to use"
marker="number": instructions to follow in order, such as installing or setting something up.marker="check": what a plan or feature includes.marker="icon"or"tile": features or benefits, each with its own icon.marker="disc"(default) or"none": any short list of items.
Use something else when:
- the person is moving through the steps and needs to see where they are: Steps
- the items are terms with values: DescriptionList
- people tick, add or reorder the items: Checklist or SortableList
- the list is part of written content from Markdown or a CMS: Prose
UsageLink to "Usage"
import { List } from "@arshad-shah/cynosure";
<List
marker="number"
label="Install"
items={[
{ label: "Add the package", description: "pnpm add @arshad-shah/cynosure" },
{ label: "Import the styles", description: "Once, at the root of the app." },
{ label: "Wrap the app in CynosureTheme" },
]}
/>Items are data, as in Steps and DescriptionList: { id?, label, description?, icon?, tone? }. Give id when items are added, removed or reordered.
Numbered how-toLink to "Numbered how-to"
marker="number" renders an ol. The numbers start at start (default 1) and follow the items. Each number sits on its item's first line, also when a description follows.
Ticks, icons and tilesLink to "Ticks, icons and tiles"
check draws a tick in the success colour. icon draws each item's icon (or the list's), and tile puts it on an IconTile. tone on the list or on an item sets the marker's colour.
Gap and dividersLink to "Gap and dividers"
PropsLink to "Props"
| Prop | What it does | Type | Default |
|---|---|---|---|
itemsRequired | The items, in order. | ListItem[] | |
marker | What sits before each item: disc a dot, number its position in a tinted circle, check a tick (a feature list), icon the item's icon, tile the item's icon on an IconTile, none nothing. Default "disc". | ListMarker | "disc" |
as | ol when the order matters (steps of a how-to), ul when it does not. Default "ol" with numbers, else "ul". | "ul" | "ol" | "ol" with numbers |
start | The number of the first item, with marker="number". Default 1. | number | 1 |
icon | Icon of every item for marker="icon" or "tile"; an item's own icon wins. Without either, a disc. | IconData | |
tone | Colour of the markers. Default: muted ink for discs, "success" for ticks, "accent" otherwise. | Tone | muted ink for discs |
gap | Space between items. Default "md". | "sm" | "md" | "lg" | "none" | "md" |
divided | A line between items. Default false. | boolean | false |
size | Text size, and with it the markers. Default "md". | Size | "md" |
label | Names the list for assistive technology ("Install steps"), when no heading above it does. | string | |
className | Added to the root element, for layout. | string | |
style | Layout only. Restyle through --cy-list-* tokens. | CSSProperties |
Generated from the type definitions in @arshad-shah/cynosure 0.5.0.
Behaviour and accessibilityLink to "Behaviour and accessibility"
- Semantics: always a real
ulorolwithliitems.role="list"is set explicitly because Safari drops the list role from a list without bullets. Screen readers announce the list, how many items it has, and each item's position. - Markers are
aria-hidden. The list gives each item's position, so numbers are not read twice; ticks, icons and tiles are decoration. labelnames the list ("Install") when no heading above it does.- Keyboard: none of its own. Nothing in a List is focusable unless you put a Link or a Button in an item.
- Right to left: markers move to the right and numbers still count down the page.
- Forced colours: discs draw in
CanvasTextand number circles get aCanvasTextoutline.
TouchLink to "Touch"
A List has nothing to press. Links or buttons you put in items keep their own hit areas.
ThemingLink to "Theming"
| Token | Default | What it sets |
|---|---|---|
--cy-list-gap-{sm,md,lg} | --cy-space-3, --cy-space-5, --cy-space-7 | Space between items |
--cy-list-marker-gap | --cy-space-5 | Space between the marker and the text |
--cy-list-marker-color | --cy-color-muted | Colour of a disc with no tone |
--cy-list-number-size | one line of the label | Diameter of the circle behind a number |
--cy-list-description-color | --cy-color-muted | Colour of the description |
--cy-list-divider-color | --cy-color-line | Colour of the line with divided |
createTheme({ components: { list: { markerGap: "12px", gapMd: "16px" } } });className and style are for layout only. Change the look through tokens so every product stays consistent.
RelatedLink to "Related"
Steps · IconTile · DescriptionList · Checklist · Prose
These examples run Cynosure 0.5.0 (commit 50ce30b), the version on npm.