Skip to content
Nana UI

Data Display & Media

Description List

Pairs of terms and values, such as the details of a policy, a claim or a customer.

View .md Download
MTR-2026-00412 Active Wanjiru Kamau Comprehensive motor KES 48,600 14 March 2027 Toyota Probox, KDA 482Q
Policy number
MTR-2026-00412
Status
Active
Policyholder
Wanjiru Kamau
Cover
Comprehensive motor
Annual premium
KES 48,600
Renews
14 March 2027
Vehicle
Toyota Probox, KDA 482Q

Install the package for a versioned dependency:

npm install @nana-tec/ui-components

Or copy the source in and own it:

npx @nana-tec/ui add description-list --framework web-components
npx @nana-tec/ui add description-list --framework svelte

Lands in src/lib/components/ui/description-list/, styled with Tailwind classes that resolve to the design tokens. Requires Tailwind v4.

Import the autoloader once, in your app's entry point. Every <nana-*> tag then works anywhere, and each component downloads only the first time a page uses it:

import "@nana-tec/ui-components/autoloader";
import "@nana-tec/ui-components/theme";

The second line gives every component the Nana look and the design tokens behind it. Leave it out to style the components entirely yourself.

Import a component directly when it must be ready at once: on screen at first paint, or when you call its methods straight away. The two mix freely:

import "@nana-tec/ui-components/description-list";

Copied in with npx @nana-tec/ui add description-list? Import your project's own @/lib/nana-ui/autoloader.js once instead; the CLI keeps it up to date.

<script lang="ts">
import { NanaDescriptionList, NanaDescriptionItem } from '$lib/components/ui/description-list';
</script>
<NanaDescriptionList>
<NanaDescriptionItem term="Policy number">MTR-2026-00412</NanaDescriptionItem>
<NanaDescriptionItem term="Premium">KES 48,600</NanaDescriptionItem>
</NanaDescriptionList>

layout="stacked", the default, puts each term above its value, which suits narrow panels and cards. layout="inline" puts the term beside its value from 640px wide and stacks them below that, which suits detail pages.

columns flows the items into two or three columns on wider screens. Set wide on an item to give a long value, such as an address or notes, a row of its own. divided draws a line under each item.

A value can hold anything: a badge, a link, a formatted number. A term is text by default.

For a richer term, put it in the term slot.

<nana-description-item>
<span slot="term">Excess <nana-tooltip content="Paid by you on each claim">?</nana-tooltip></span>
KES 15,000
</nana-description-item>

For a richer term, pass a snippet.

<NanaDescriptionItem>
{#snippet term()}Excess <abbr title="Paid by you on each claim">?</abbr>{/snippet}
KES 15,000
</NanaDescriptionItem>

The list is a native <dl>, each item a <div> holding a <dt> and a <dd>, so screen readers announce how many items there are and pair each term with its value.

A native <dl> cannot reach across shadow roots, so the list takes the list role, each item listitem, and inside it the term and value take the term and definition roles. Screen readers announce how many items there are and read each term with its value.

Give the list an aria-label when there are several on one page, such as “Policy” and “Vehicle”.

Properties

PropertyAttributeTypeDefaultDescription
columnscolumnsDescriptionColumns1How many columns the items flow into on wider screens: 1, 2 or 3.
divideddividedbooleanfalseDraws a line under each item.
layoutlayoutDescriptionLayout'stacked'stacked puts each term above its value; inline puts them side by side from 640px wide.

Slots

SlotDescription
(default)The nana-description-item elements

CSS custom properties

PropertyDescription
--nana-description-column-gapSpace between columns
--nana-description-row-gapSpace between rows when there are no dividers

Properties

PropertyAttributeTypeDefaultDescription
divideddividedbooleanfalseSet by the list it sits in.
layoutlayoutDescriptionLayout'stacked'Set by the list it sits in.
termtermstring''The term. Use the term slot for anything richer than text.
widewidebooleanfalseSpans every column of the list, for long values such as an address.

Slots

SlotDescription
(default)The value
termThe term, when it needs more than the term text

CSS parts

PartDescription
::part(item)The row around the term and value
::part(term)The term
::part(details)The value

CSS custom properties

PropertyDescription
--nana-description-term-colorTerm colour
--nana-description-value-colorValue colour
--nana-description-term-widthWidest the term column grows in the inline layout
--nana-description-borderDivider colour in a divided list

NanaDescriptionItem

PropTypeDefault
termstring | Snippet
widebooleanfalse
childrenSnippet

Also accepts Omit<HTMLAttributes<HTMLDivElement>, 'class'>.

NanaDescriptionList

PropTypeDefault
layoutDescriptionLayout'stacked'
columnsDescriptionColumns1
dividedbooleanfalse
childrenSnippet

Also accepts Omit<HTMLAttributes<HTMLDListElement>, 'class'>.