<NbContainedList title="Waiting on you">
<template #meta>{{ items.length }}</template>
<NbContainedListItem
v-for="item in items"
:key="item.id"
:item-key="item.key"
:title="item.title"
:line="item.due"
:to="item.route"
>
<template #trailing>
<NbBadge v-if="item.blocked" size="sm" variant="red">Blocked</NbBadge>
</template>
</NbContainedListItem>
</NbContainedList>When to use it
- A short list inside something else. Five things waiting on someone in a dashboard tile, the spaces in an aside, the links of a record. The list has no column headers, no sorting, no paging.
- Rows that are one thing each. A key, a name, a line of context and one trailing fact (a badge, a count, a date).
Reach for something else when:
| The list needs | Use |
|---|---|
| Column headers, several facts per row | NbStructuredList |
| Sorting, selection, paging, row actions | NbDataTable |
| Term and value pairs about one thing | NbDefinitionList |
| Reordering by drag | NbReorderList |
The row
Every row has the same anatomy, so a list of them scans down one edge:
item-key: a short identifier before the title, mono and subtle. Optional.title: the row's name, atheading-compact. One line, truncated, unless the list or the row haswrap, for names that lose their point when cut. See Titles that wrap.line: one line of context under it,body-sm, muted. Optional.#leading: an avatar, an icon or a status dot before everything.#trailing: one badge or a count at the end. Not a control: a row that is a link or a button cannot hold another control.
Rows that do something
A row with to or href is a link. A row with clickable is a button that emits select. Either one is a whole-row target with a hover from --nb-c-surface-hover, and current marks the one that is open.
Size
size sets the row height: sm 32px, md 40px (the default), lg 48px. Rows with a line grow to fit it. Pick one size per list: two sizes in one tile reads as two lists.
In the page's hierarchy
A contained list is a supporting element. Its title is heading-compact, quieter than the panel or tile it sits in, and its rows are equal peers. When one item is the point of the page, it does not belong in a row: give it its own region. See Information hierarchy.