List
List shows items of text as a bulleted list or a numbered list.
<List> <ListItem>Invite your team</ListItem> <ListItem> Deploy the first build <List> <ListItem>Preview builds run on every push</ListItem> </List> </ListItem></List>Use a List for items of text, such as the features of a plan or the steps of a task. For items with no markers, use Stack. For items with icons or actions, use Row. For items that each have several values, use Table.
Set ordered when the order of the items matters, such as steps to follow or a ranking, and the List renders an <ol> with numbers. Otherwise it renders a <ul> with bullets. On a numbered list, start and reversed change what the numbers say. A bulleted list does not accept them.
A List accepts the same size, weight, emphasis and tone props as Text, and the default size is 3. The space for the markers grows with the text size. Bullets always use the faint text colour, so they stay in the background, while numbers use the same colour as the words, because people read and refer to them.
To nest a list, put a List inside a ListItem. It indents one level and takes the text size of the item, so it needs no props.
A screen reader announces a list and the number of items in it.
Topics
Every symbol this component exports, grouped by the job it does. Each one carries the props it declares; each one has an anchor of its own.
Creating the list
| Prop | Type | What it does |
|---|---|---|
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
emphasis? | "loud" | "medium" | "quiet" | Sets how strong the text colour is. |
ordered? | false | Renders a bulleted <ul>. |
reversed? | never | Not available on a bulleted list, because bullets have no order to reverse. |
size? | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | Sets the text size, from 1 to 9. |
start? | never | Not available on a bulleted list, because there is no number to start from. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
tone? | "neutral" | "accent" | "destructive" | "blue" | "green" | "orange" | "amber" | "pink" | "purple" | "success" | "warning" | "info" | Sets the colour family of the words and the markers. |
weight? | "regular" | "medium" | "semibold" | Sets the font weight. |
It also takes every prop of a <ul>.
- A custom marker — The list type sets the marker: bullets for a bulleted list and numbers for a numbered one. For no markers, use a
Stack. For icons, useRow. render—orderedchooses between<ul>and<ol>. Any other element would not be announced as a list by a screen reader.- A
gapor density prop — The space between items is set by the theme, so every list in your app has the same spacing. To change it for the whole app, set the theme's density. - A description list — A
<dl>pairs terms with their details, which is a different structure from a list of items. It is planned as a separate component.