Skip to content
Cynosurev0.5.0
SearchStorybookGitHubnpmColour mode: System. Switch to Light

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.

Default

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"

tsx
Copy
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"

Gap and dividers

PropsLink to "Props"

Every prop of List
PropWhat it doesTypeDefault
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.number1
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.Tonemuted ink for discs
gap
Space between items. Default "md"."sm" | "md" | "lg" | "none""md"
divided
A line between items. Default false.booleanfalse
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 ul or ol with li items. 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.
  • label names 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 CanvasText and number circles get a CanvasText outline.

TouchLink to "Touch"

A List has nothing to press. Links or buttons you put in items keep their own hit areas.

ThemingLink to "Theming"

Theming, table 1
TokenDefaultWhat it sets
--cy-list-gap-{sm,md,lg}--cy-space-3, --cy-space-5, --cy-space-7Space between items
--cy-list-marker-gap--cy-space-5Space between the marker and the text
--cy-list-marker-color--cy-color-mutedColour of a disc with no tone
--cy-list-number-sizeone line of the labelDiameter of the circle behind a number
--cy-list-description-color--cy-color-mutedColour of the description
--cy-list-divider-color--cy-color-lineColour of the line with divided
ts
Copy
createTheme({ components: { list: { markerGap: "12px", gapMd: "16px" } } });

className and style are for layout only. Change the look through tokens so every product stays consistent.

Steps · IconTile · DescriptionList · Checklist · Prose

These examples run Cynosure 0.5.0 (commit 50ce30b), the version on npm.

Getting started
Theming
Icons
Accessibility
Code editors and highlighters
Using Cynosure without React
Build-tool adapters
Components
Accordion
AppShell
AspectRatio
Breadcrumbs
Calendar
Card
Container
Disclosure
Divider
DocumentViewport
Grid
Inline
PageHeader
PanZoomCanvas
ScrollArea
SideNav
SortableList
SplitPane
Stack
StatusBar
Tabs
TitleBar
Toolbar
Tree
VirtualList
ZoomControls
Announcer
Avatar
Badge
CodeBlock
DescriptionList
EmptyState
ErrorBoundary
Field
Heading
IconTile
Image
Kbd
List
LoadingDots
Notice
ProgressBar
Prose
Skeleton
Stat
Steps
Table
Text
Button
Checkbox
Checklist
ColorField
ColorSwatches
Combobox
CompareSlider
CopyButton
DateField
FileDrop
IconButton
KeyValueEditor
Link
NumberField
Pagination
PathField
RadioGroup
SearchField
SegmentedControl
Select
SelectionFrame
SignaturePad
Slider
Switch
TagInput
TextArea
TextField
ThemeToggle
TimeField
ButtonBase
ChoiceBase
DialogBase
FileInputBase
HiddenValue
Icon
InputBase
LinkBase
LiveRegion
TextAreaBase
ChatMessage
Choice
DataGrid
DeviceFrame
HighlightedText
HotkeyField
ListRow
OptionList
OverlayFrame
QRCode
RowActions
Section
SiteFooter
SiteHeader
SkipLink
SortButton
VisuallyHidden
CommandPalette
ContextMenu
Dialog
FloatingToolbar
HoverCard
Menu
Menubar
Popover
ProgressOverlay
Sheet
Toast
Tooltip
Changelog