List
A vertical run of related rows, with named groups, an empty message and a marker the list draws itself.
import { List } from '@slotted/react/list';import { ListItem, ListItemBody, ListItemDescription, ListItemEnd, ListItemLabel, ListItemLink,} from '@slotted/react/list-item';const WAREHOUSES = [ { id: 'reno', name: 'Reno', summary: '312 orders to ship today', open: '1,284' }, { id: 'columbus', name: 'Columbus', summary: '198 orders to ship today', open: '962' }, { id: 'savannah', name: 'Savannah', summary: '74 orders to ship today', open: '418' },];export default function ListBasic() { return ( <List aria-label="Warehouses" variant="ruled"> {WAREHOUSES.map((warehouse) => ( <ListItem key={warehouse.id}> <ListItemLink href={`#${warehouse.id}`}> <ListItemBody> <ListItemLabel>{warehouse.name}</ListItemLabel> <ListItemDescription>{warehouse.summary}</ListItemDescription> </ListItemBody> <ListItemEnd>{warehouse.open}</ListItemEnd> </ListItemLink> </ListItem> ))} </List> );}Installation
The packages are a 0.x beta on npm, and their public API changes between beta releases without deprecation. One line installs the binding and the default theme.
pnpm add @slotted/react @slotted/theme @slotted/themesimport { List, ListDefaultsProvider, ListEmpty, ListSection } from '@slotted/react';Variants
variant decides how the rows are told apart. plain, the default, separates them by spacing alone, which suits a short run inside a card. ruled draws a hairline between rows. framed adds a box around the set. separated gives every row a surface of its own and is the only variant that puts a gap between rows.
- UPS Ground
- FedEx Express
- UPS Ground
- FedEx Express
- UPS Ground
- FedEx Express
- UPS Ground
- FedEx Express
import { List, type ListVariant } from '@slotted/react/list';import { ListItem, ListItemBody, ListItemContent, ListItemLabel } from '@slotted/react/list-item';import { Stack } from '@slotted/react/stack';import { Text } from '@slotted/react/typography';const VARIANTS: ListVariant[] = ['plain', 'ruled', 'framed', 'separated'];export default function ListVariants() { return ( <Stack gap={5}> {VARIANTS.map((variant) => ( <Stack gap={2} key={variant}> <Text size="sm" tone="muted"> {variant} </Text> <List aria-label={`Carriers, ${variant}`} variant={variant}> {['UPS Ground', 'FedEx Express'].map((carrier) => ( <ListItem key={carrier}> <ListItemContent> <ListItemBody> <ListItemLabel>{carrier}</ListItemLabel> </ListItemBody> </ListItemContent> </ListItem> ))} </List> </Stack> ))} </Stack> );}Sizes
size sets the room each row gets: sm, md, the default, or lg. It changes the row’s minimum height, padding, gap and type size together, so a dense side panel and a roomy settings page use the same markup.
- Aisle 4, bin 12
- Aisle 4, bin 13
- Aisle 4, bin 12
- Aisle 4, bin 13
- Aisle 4, bin 12
- Aisle 4, bin 13
import { List, type ListSize } from '@slotted/react/list';import { ListItem, ListItemBody, ListItemContent, ListItemLabel } from '@slotted/react/list-item';import { Stack } from '@slotted/react/stack';import { Text } from '@slotted/react/typography';const SIZES: ListSize[] = ['sm', 'md', 'lg'];export default function ListSizes() { return ( <Stack gap={5}> {SIZES.map((size) => ( <Stack gap={2} key={size}> <Text size="sm" tone="muted"> {size} </Text> <List aria-label={`Bins, ${size}`} size={size} variant="ruled"> {['Aisle 4, bin 12', 'Aisle 4, bin 13'].map((bin) => ( <ListItem key={bin}> <ListItemContent> <ListItemBody> <ListItemLabel>{bin}</ListItemLabel> </ListItemBody> </ListItemContent> </ListItem> ))} </List> </Stack> ))} </Stack> );}Markers
marker paints the marker column: none, the default, a drawn bullet, or a number. The reading order is a separate decision. In React, ordered renders an ol; in Angular, the directive goes on the ol you write. An ordered list can paint no number and still read in order, and the bullet keeps its shape whatever typeface the reader has.
- Lithium batteries ship by ground only
- Parcels over 30 kg need a two-person lift label
- Receive the pallet at dock 3
- Scan every carton
- Put each carton away by bin
import { List } from '@slotted/react/list';import { ListItem, ListItemBody, ListItemContent, ListItemLabel } from '@slotted/react/list-item';import { Stack } from '@slotted/react/stack';import { Text } from '@slotted/react/typography';const RULES = [ 'Lithium batteries ship by ground only', 'Parcels over 30 kg need a two-person lift label',];const STEPS = ['Receive the pallet at dock 3', 'Scan every carton', 'Put each carton away by bin'];export default function ListMarkers() { return ( <Stack gap={5}> <Stack gap={2}> <Text size="sm" tone="muted"> bullet </Text> <List aria-label="Shipping rules" marker="bullet"> {RULES.map((rule) => ( <ListItem key={rule}> <ListItemContent> <ListItemBody> <ListItemLabel>{rule}</ListItemLabel> </ListItemBody> </ListItemContent> </ListItem> ))} </List> </Stack> <Stack gap={2}> <Text size="sm" tone="muted"> number, ordered </Text> <List aria-label="Receiving steps" marker="number" ordered> {STEPS.map((step) => ( <ListItem key={step}> <ListItemContent> <ListItemBody> <ListItemLabel>{step}</ListItemLabel> </ListItemBody> </ListItemContent> </ListItem> ))} </List> </Stack> </Stack> );}Groups
ListSection in React and li[slListSection] in Angular hold a heading and a nested list of rows. The nested list names itself by the heading through aria-labelledby, so a screen reader that lands inside a group announces which group it is. end in React, or an element marked slListSectionEnd in Angular, stands at the end of the heading line in tabular figures, for a day’s total or a count. The heading is an h3 by default; React sets it with level, Angular uses the heading element you write.
Today$4,820.00
- Contoso FoodsPO-2291$3,150.00
- Aster BakeryPO-2290$1,670.00
Yesterday$3,115.50
- Bluefin MarketPO-2289$2,240.50
- Driftwood InnPO-2288$875.00
import { List, ListSection } from '@slotted/react/list';import { ListItem, ListItemBody, ListItemContent, ListItemDescription, ListItemEnd, ListItemLabel,} from '@slotted/react/list-item';const DAYS = [ { day: 'Today', total: '$4,820.00', payouts: [ { id: 'PO-2291', customer: 'Contoso Foods', amount: '$3,150.00' }, { id: 'PO-2290', customer: 'Aster Bakery', amount: '$1,670.00' }, ], }, { day: 'Yesterday', total: '$3,115.50', payouts: [ { id: 'PO-2289', customer: 'Bluefin Market', amount: '$2,240.50' }, { id: 'PO-2288', customer: 'Driftwood Inn', amount: '$875.00' }, ], },];export default function ListSections() { return ( <List aria-label="Payouts" variant="ruled"> {DAYS.map((group) => ( <ListSection end={group.total} key={group.day} label={group.day}> {group.payouts.map((payout) => ( <ListItem key={payout.id}> <ListItemContent> <ListItemBody> <ListItemLabel>{payout.customer}</ListItemLabel> <ListItemDescription>{payout.id}</ListItemDescription> </ListItemBody> <ListItemEnd>{payout.amount}</ListItemEnd> </ListItemContent> </ListItem> ))} </ListSection> ))} </List> );}Sticky group headings
sticky keeps a group’s heading in place while its own rows scroll under it, inside the nearest scroll container. The heading takes the list’s surface and the library’s sticky stack level, so a row scrolling under it is covered rather than showing through. labelVariant="ruled" in React, or variant="ruled" on slListSectionLabel in Angular, draws the name in the text color over a rule instead of the default small muted caption. Scroll the movements to watch each day’s heading hold until the next one replaces it.
Monday4 moves
- Oat flour, 25 kg+40
- Rye flour, 25 kg+24
- Sea salt, 5 kg−12
- Cane sugar, 10 kg−30
Tuesday4 moves
- Oat flour, 25 kg−18
- Dried yeast, 500 g+60
- Butter, 10 kg−8
- Sea salt, 5 kg+20
Wednesday4 moves
- Rye flour, 25 kg−16
- Cane sugar, 10 kg+45
- Butter, 10 kg+12
- Dried yeast, 500 g−22
import { List, ListSection } from '@slotted/react/list';import { ListItem, ListItemBody, ListItemContent, ListItemEnd, ListItemLabel,} from '@slotted/react/list-item';import { ScrollArea } from '@slotted/react/scroll-area';const DAYS = [ { day: 'Monday', moves: [ { id: 'MV-801', sku: 'Oat flour, 25 kg', quantity: '+40' }, { id: 'MV-802', sku: 'Rye flour, 25 kg', quantity: '+24' }, { id: 'MV-803', sku: 'Sea salt, 5 kg', quantity: '−12' }, { id: 'MV-804', sku: 'Cane sugar, 10 kg', quantity: '−30' }, ], }, { day: 'Tuesday', moves: [ { id: 'MV-805', sku: 'Oat flour, 25 kg', quantity: '−18' }, { id: 'MV-806', sku: 'Dried yeast, 500 g', quantity: '+60' }, { id: 'MV-807', sku: 'Butter, 10 kg', quantity: '−8' }, { id: 'MV-808', sku: 'Sea salt, 5 kg', quantity: '+20' }, ], }, { day: 'Wednesday', moves: [ { id: 'MV-809', sku: 'Rye flour, 25 kg', quantity: '−16' }, { id: 'MV-810', sku: 'Cane sugar, 10 kg', quantity: '+45' }, { id: 'MV-811', sku: 'Butter, 10 kg', quantity: '+12' }, { id: 'MV-812', sku: 'Dried yeast, 500 g', quantity: '−22' }, ], },];export default function ListSticky() { return ( <ScrollArea maxBlockSize="16rem" messages={{ label: 'Stock movements' }}> <ScrollArea.Content> <List aria-label="Stock movements" variant="ruled"> {DAYS.map((group) => ( <ListSection end={`${group.moves.length} moves`} key={group.day} label={group.day} labelVariant="ruled" sticky > {group.moves.map((move) => ( <ListItem key={move.id}> <ListItemContent> <ListItemBody> <ListItemLabel>{move.sku}</ListItemLabel> </ListItemBody> <ListItemEnd>{move.quantity}</ListItemEnd> </ListItemContent> </ListItem> ))} </ListSection> ))} </List> </ScrollArea.Content> </ScrollArea> );}Inside a padded box
A card body or a dialog already pads its content, so rows that carry their own inline padding stand two insets in from the box edge. inset removes the rows’ inline padding: the names line up with the card heading, and the rules and the hover fill still run edge to edge.
On shift in Reno
- Amara NwosuShift lead, receiving
- Diego MoralesPicker, aisles 1 to 6
- Ingrid HolmPacker, station 2
import { Card, CardBody, CardHeader } from '@slotted/react/card';import { List } from '@slotted/react/list';import { ListItem, ListItemBody, ListItemContent, ListItemDescription, ListItemLabel,} from '@slotted/react/list-item';import { Heading } from '@slotted/react/typography';const CREW = [ { name: 'Amara Nwosu', role: 'Shift lead, receiving' }, { name: 'Diego Morales', role: 'Picker, aisles 1 to 6' }, { name: 'Ingrid Holm', role: 'Packer, station 2' },];export default function ListInset() { return ( <Card> <CardHeader> <Heading level={3} size="md"> On shift in Reno </Heading> </CardHeader> <CardBody> <List aria-label="On shift in Reno" inset variant="ruled"> {CREW.map((person) => ( <ListItem key={person.name}> <ListItemContent> <ListItemBody> <ListItemLabel>{person.name}</ListItemLabel> <ListItemDescription>{person.role}</ListItemDescription> </ListItemBody> </ListItemContent> </ListItem> ))} </List> </CardBody> </Card> );}Loading
loading writes aria-busy on the list and draws nothing of its own. The rows stay in place with loading set on each, and Skeleton lines stand in for the text at the widths the loaded text takes, so nothing moves when the data arrives. A SkeletonRegion around the list waits 200 milliseconds before drawing and announces the wait once. Refresh carriers starts a 1.5-second load.
import { useEffect, useState } from 'react';import { Button } from '@slotted/react/button';import { List } from '@slotted/react/list';import { ListItem, ListItemBody, ListItemContent, ListItemDescription, ListItemEnd, ListItemLabel,} from '@slotted/react/list-item';import { Skeleton, SkeletonRegion } from '@slotted/react/skeleton';import { Stack } from '@slotted/react/stack';const CARRIERS = [ { name: 'UPS Ground', cutoff: 'Pickup at 16:30', parcels: '142', widths: ['6rem', '7rem'] }, { name: 'FedEx Express', cutoff: 'Pickup at 17:00', parcels: '38', widths: ['7.5rem', '7rem'] }, { name: 'USPS Priority', cutoff: 'Drop-off by 18:00', parcels: '61', widths: ['7rem', '8rem'] },];export default function ListLoading() { const [loading, setLoading] = useState(true); useEffect(() => { if (!loading) return; const timer = setTimeout(() => setLoading(false), 1500); return () => clearTimeout(timer); }, [loading]); return ( <Stack align="start" gap={3}> <Button onClick={() => setLoading(true)} size="sm" variant="outline"> Refresh carriers </Button> <SkeletonRegion delay={200} loading={loading} messages={{ label: 'Loading carriers' }} minDuration={400} > <List aria-label="Carriers" loading={loading} variant="ruled"> {CARRIERS.map((carrier) => ( <ListItem key={carrier.name} loading={loading}> <ListItemContent> <ListItemBody> <ListItemLabel> {loading ? <Skeleton inlineSize={carrier.widths[0]} /> : carrier.name} </ListItemLabel> <ListItemDescription> {loading ? <Skeleton inlineSize={carrier.widths[1]} /> : carrier.cutoff} </ListItemDescription> </ListItemBody> <ListItemEnd> {loading ? <Skeleton inlineSize="2rem" /> : carrier.parcels} </ListItemEnd> </ListItemContent> </ListItem> ))} </List> </SkeletonRegion> </Stack> );}Empty
ListEmpty in React and li[slListEmpty] in Angular are the message a list shows when it holds no rows. The message is an li inside the list, so a screen reader announces a list of one item and reads the message, rather than announcing an empty list and nothing else, and the words stay inside the frame of a framed list.
No returns waiting
A return appears here once the customer ships the parcel back.
import { List, ListEmpty } from '@slotted/react/list';import { Heading, Text } from '@slotted/react/typography';export default function ListEmptyExample() { return ( <List aria-label="Returns" variant="framed"> <ListEmpty> <Heading level={3} size="md"> No returns waiting </Heading> <Text tone="muted">A return appears here once the customer ships the parcel back.</Text> </ListEmpty> </List> );}A page of a larger set
When the list shows one page of a longer result, set position and setSize on each row. They write aria-posinset and aria-setsize, so a screen reader announces the row as 41 of 128 rather than 1 of 3. Leave them out when every row is present. Name the list after the page it shows.
- SO-1141Granite Outfitters$612.40
- SO-1142Cobalt Fitness$1,208.00
- SO-1143Fernhill School$94.75
import { List } from '@slotted/react/list';import { ListItem, ListItemBody, ListItemContent, ListItemDescription, ListItemEnd, ListItemLabel,} from '@slotted/react/list-item';const ORDERS = [ { position: 41, id: 'SO-1141', customer: 'Granite Outfitters', total: '$612.40' }, { position: 42, id: 'SO-1142', customer: 'Cobalt Fitness', total: '$1,208.00' }, { position: 43, id: 'SO-1143', customer: 'Fernhill School', total: '$94.75' },];export default function ListPageOfSet() { return ( <List aria-label="Orders 41 to 43 of 128" variant="ruled"> {ORDERS.map((order) => ( <ListItem key={order.id} position={order.position} setSize={128}> <ListItemContent> <ListItemBody> <ListItemLabel>{order.id}</ListItemLabel> <ListItemDescription>{order.customer}</ListItemDescription> </ListItemBody> <ListItemEnd>{order.total}</ListItemEnd> </ListItemContent> </ListItem> ))} </List> );}Navigation
A list of links inside a nav landmark is a navigation menu. The list writes no landmark itself: the nav and its aria-label belong to the page. current="page" on the row of the page being shown writes aria-current on the row and paints it as current. Choose a section to move the current row.
import { type MouseEvent, useState } from 'react';import { List } from '@slotted/react/list';import { ListItem, ListItemBody, ListItemLabel, ListItemLink } from '@slotted/react/list-item';const SECTIONS = [ { href: '#general', name: 'General' }, { href: '#warehouses', name: 'Warehouses' }, { href: '#carriers', name: 'Carriers' }, { href: '#billing', name: 'Billing' },];export default function ListNavigation() { const [here, setHere] = useState('#warehouses'); function handleNavigate(event: MouseEvent<HTMLAnchorElement>, href: string) { event.preventDefault(); setHere(href); } return ( <nav aria-label="Settings"> <List> {SECTIONS.map((section) => ( <ListItem current={section.href === here ? 'page' : false} key={section.href}> <ListItemLink href={section.href} onClick={(event) => handleNavigate(event, section.href)} > <ListItemBody> <ListItemLabel>{section.name}</ListItemLabel> </ListItemBody> </ListItemLink> </ListItem> ))} </List> </nav> );}Selectable rows
The list draws no check of its own. A Checkbox in the row’s start slot is the control a reader operates and the element a screen reader announces, and selected on the row paints the selection. Badge in the end slot carries the row’s count. Pick an order to add it to the pick list.
- SO-1182Contoso Foods6 lines
- SO-1183Atlas Freight2 lines
- SO-1184Ember Goods11 lines
import { useState } from 'react';import { Badge } from '@slotted/react/badge';import { Checkbox } from '@slotted/react/checkbox';import { List } from '@slotted/react/list';import { ListItem, ListItemBody, ListItemContent, ListItemDescription, ListItemEnd, ListItemLabel, ListItemStart,} from '@slotted/react/list-item';import { Stack } from '@slotted/react/stack';import { Text } from '@slotted/react/typography';import { VisuallyHidden } from '@slotted/react/visually-hidden';const ORDERS = [ { id: 'SO-1182', customer: 'Contoso Foods', lines: 6 }, { id: 'SO-1183', customer: 'Atlas Freight', lines: 2 }, { id: 'SO-1184', customer: 'Ember Goods', lines: 11 },];export default function ListSelection() { const [picked, setPicked] = useState<string[]>(['SO-1182']); function handlePick(id: string, checked: boolean) { setPicked((current) => (checked ? [...current, id] : current.filter((entry) => entry !== id))); } return ( <Stack gap={3}> <List aria-label="Orders to pick" variant="ruled"> {ORDERS.map((order) => ( <ListItem key={order.id} selected={picked.includes(order.id)}> <ListItemContent> <ListItemStart> <Checkbox checked={picked.includes(order.id)} onCheckedChange={(checked) => handlePick(order.id, checked)} > <VisuallyHidden>Pick {order.id}</VisuallyHidden> </Checkbox> </ListItemStart> <ListItemBody> <ListItemLabel>{order.id}</ListItemLabel> <ListItemDescription>{order.customer}</ListItemDescription> </ListItemBody> <ListItemEnd> <Badge variant="soft">{order.lines} lines</Badge> </ListItemEnd> </ListItemContent> </ListItem> ))} </List> <Text size="sm" tone="muted"> {picked.length} of {ORDERS.length} orders on the pick list </Text> </Stack> );}Defaults for an application
ListDefaultsProvider in React and provideListDefaults in Angular set variant, size, marker and inset once for every list under them. A value a list sets itself still wins: the first list below reads ruled and sm from the provider, and the second keeps the sm size and states framed.
- UPS Ground
- FedEx Express
- Dock 1, inbound
- Dock 3, outbound
import { List, ListDefaultsProvider } from '@slotted/react/list';import { ListItem, ListItemBody, ListItemContent, ListItemLabel } from '@slotted/react/list-item';import { Stack } from '@slotted/react/stack';const ROWS = { carriers: ['UPS Ground', 'FedEx Express'], docks: ['Dock 1, inbound', 'Dock 3, outbound'],};export default function ListDefaultsExample() { return ( <ListDefaultsProvider size="sm" variant="ruled"> <Stack gap={5}> <List aria-label="Carriers"> {ROWS.carriers.map((name) => ( <ListItem key={name}> <ListItemContent> <ListItemBody> <ListItemLabel>{name}</ListItemLabel> </ListItemBody> </ListItemContent> </ListItem> ))} </List> <List aria-label="Docks" variant="framed"> {ROWS.docks.map((name) => ( <ListItem key={name}> <ListItemContent> <ListItemBody> <ListItemLabel>{name}</ListItemLabel> </ListItemBody> </ListItemContent> </ListItem> ))} </List> </Stack> </ListDefaultsProvider> );}Accessibility
| Key | Effect | Focus |
|---|---|---|
| Tab | moves to the next focusable element; every control a row holds is in the page tab sequence | the next focusable element |
| Shift+Tab | moves to the previous focusable element, under the same rule | the previous focusable element |
- A static list has no pattern in the ARIA Authoring Practices, which cover interactive collections such as Listbox and Grid. List follows HTML and the ARIA roles model.
- role="list" is written on the root and on every nested group. It is not redundant: List draws its own marker, and Safari with VoiceOver drops list semantics when CSS removes the native one. A role written on the element, such as menu or listbox, is kept.
- A group is an li that holds a heading and a nested list, and the nested list is named by that heading through aria-labelledby. A screen reader that lands inside a group announces which group it is.
- loading writes aria-busy on the list, which ARIA 1.2 asks of a container whose content has not arrived. List draws no spinner and no placeholder; Skeleton goes inside the rows.
- The empty message is an li inside the list. Outside the list, a screen reader announces a list of zero items and reads nothing more, and the words fall outside the frame of a framed list.
- List binds no key. Every control a row holds is in the page tab sequence, so Tab and Shift+Tab move between them. Arrow keys, Home, End and typeahead belong to Listbox and Table.
- List holds no state a consumer can own, so it emits no event. A row paints a selection with selected, and the Checkbox composed into the row announces it.
API
List
Props
variant'plain' | 'ruled' | 'framed' | 'separated'Defaultplain- How the rows are told apart: by spacing, by a rule between them, by a box around the list, or by a surface for each row.
size'sm' | 'md' | 'lg'Defaultmd- The room a row gets: its minimum height, padding, gap and type size. Density is set by the application; size is set per list.
marker'none' | 'bullet' | 'number'Defaultnone- What is painted in the marker column. List draws the marker itself, so removing it never removes the list semantics.
orderedbooleanDefaultfalse- Renders an ol, so the reading order of the rows is part of the markup rather than only of the look.
insetbooleanDefaultfalse- Removes the rows' inline padding, for a list inside a box that already pads its content. Rules and hover fills still run edge to edge.
fill'row' | 'inset'Defaultrow- How a row draws its hover, pressed, selected and current grounds. row: edge to edge of the list. inset, for a plain or ruled list inside a container that pads its content: as a tile with the row radius that reaches past the content by --slotted-list-fill-inset on each side, while the content keeps the inline edge of the container. A framed or separated list keeps row.
loadingbooleanDefaultfalse- Writes aria-busy on the list and draws nothing. Skeleton, composed inside the rows, stands in for their content.
level'none' | '1' | '2' | '3' | '4' | '5' | '6'Default3- On ListSectionThe heading element a group name renders as. none renders a div, which is not announced as a heading.
stickybooleanDefaultfalse- On ListSectionKeeps a group name in place while its own rows scroll past it, above the rows and on the list surface.
endReactNode- On ListSectionWhat stands at the end of the group heading, on the line of the name, in tabular figures.
labelVariant'caption' | 'ruled'Defaultcaption- On ListSectionHow the group heading is drawn: caption is the small muted name, ruled is the name over a rule with no background.
labelReactNode- On ListSectionThe group name. The nested list is named by it through aria-labelledby.
labelProps / listPropsHTMLAttributes- On ListSectionProps for the heading and the nested list elements, for an id or a class the page owns.
render(props) => ReactNode- On List, ListSection, ListEmptyRenders the part's props into another element, such as a router's own list.
refRef<HTMLElement>- On every partReaches the native element. Each part accepts the props of its own element.
aria-label / aria-labelledbystring- The list's accessible name, passed through to the element. List adds no name of its own.
ListDefaultsProvider{ variant, size, marker, inset }- On a subtreeSets variant, size, marker and inset once for every list under it. A prop set on a list still wins.
Parts
| Part | Element | Required | Purpose |
|---|---|---|---|
root | ul or ol, or the element render returns | Yes | The list. It carries data-ui="list", the three axes, data-inset, data-loading and role="list". The role is not redundant: List draws its own marker, and Safari drops list semantics when CSS removes the native one. |
section | li | No | One group: the li that holds a heading and the rows under it, which is the grouping HTML already has. |
section-label | h1 to h6, or a div | No | The group name. It carries the id the nested list is named by, data-sticky when it holds still while its own rows scroll past, and data-variant: caption, the small muted name, or ruled, the name in the text color over a rule with no background. |
section-end | span | No | What stands at the end of the heading, on the line of the name: a day's total, a count. It is set in tabular figures and rendered from the end prop. |
section-list | ul or ol | No | The rows of one group. It takes the element of the list around it, carries role="list" for the same reason the root does, and is named by the heading above it. |
empty | li | No | The message the list shows when it holds no rows. It sits inside the list, so a screen reader reads the message rather than announcing zero items and stopping. |
Theming
Each token is a CSS custom property: set it in a theme, or on any element to retune every list inside it.
List tokens
| Token | Default |
|---|---|
--slotted-list-background | var(--slotted-surface, Canvas) |
--slotted-list-border-color | var(--slotted-border-subtle, ButtonBorder) |
--slotted-list-border-width | var(--slotted-border-width-thin, 1px) |
--slotted-list-empty-color | var(--slotted-text-muted, GrayText) |
--slotted-list-empty-padding | var(--slotted-space-8, 1.5rem) |
--slotted-list-empty-padding-lg | var(--slotted-space-9, 2rem) |
--slotted-list-empty-padding-sm | var(--slotted-space-6, 1rem) |
--slotted-list-fill-inset | var(--slotted-space-3, 0.375rem) |
--slotted-list-gap | var(--slotted-space-3, 0.375rem) |
--slotted-list-gap-lg | var(--slotted-space-4, 0.5rem) |
--slotted-list-gap-sm | var(--slotted-space-2, 0.25rem) |
--slotted-list-padding-inline | var(--slotted-control-padding-inline-md, 13px) |
--slotted-list-padding-inline-lg | var(--slotted-control-padding-inline-lg, 16px) |
--slotted-list-padding-inline-sm | var(--slotted-control-padding-inline-sm, 10px) |
--slotted-list-radius | var(--slotted-radius-md, 6px) |
--slotted-list-section-background | var(--slotted-surface, Canvas) |
--slotted-list-section-color | var(--slotted-text-muted, GrayText) |
--slotted-list-section-font-size | var(--slotted-font-size-xs, 0.75rem) |
--slotted-list-section-font-weight | var(--slotted-font-weight-semibold, 600) |
--slotted-list-section-letter-spacing | 0 |
--slotted-list-section-padding-block | var(--slotted-space-4, 0.5rem) |
--slotted-list-section-padding-block-lg | var(--slotted-space-5, 0.75rem) |
--slotted-list-section-padding-block-sm | var(--slotted-space-3, 0.375rem) |
--slotted-list-section-rule-color | var(--slotted-border-subtle, GrayText) |
--slotted-list-section-ruled-color | var(--slotted-text, CanvasText) |
Theme tokens it reads
| Token | Default |
|---|---|
--slotted-border-subtle | Set per scheme by the theme |
--slotted-border-width-thin | 1px |
--slotted-control-padding-inline-lg | comfortable 16px · compact 12px · dense 10px |
--slotted-control-padding-inline-md | comfortable 13px · compact 10px · dense 8px |
--slotted-control-padding-inline-sm | comfortable 10px · compact 8px · dense 6px |
--slotted-font-size-xs | 0.75rem |
--slotted-font-weight-medium | 500 |
--slotted-font-weight-semibold | 600 |
--slotted-line-height-sm | 1.45 |
--slotted-radius-md | 6px |
--slotted-space-2 | 0.25rem |
--slotted-space-3 | 0.375rem |
--slotted-space-4 | 0.5rem |
--slotted-space-5 | 0.75rem |
--slotted-space-6 | 1rem |
--slotted-space-8 | 1.5rem |
--slotted-space-9 | 2rem |
--slotted-surface | Set per scheme by the theme |
--slotted-text | Set per scheme by the theme |
--slotted-text-muted | Set per scheme by the theme |
--slotted-z-index-sticky | 100 |