# Description List

> A record's facts as label and value pairs, in rows or columns, with Copy for ids.

Page: https://uicontext.com/docs/components/description-list

Group: Records.

## When to use

A record's facts as label and value pairs, in rows or columns, with Copy for ids. Use [Record Detail](https://uicontext.com/docs/components/record-detail.md) instead when people edit the fields in place.

## Usage

```ts
import { DescriptionList } from "./ui/uicontext/components/DescriptionList.ts"

export const Invoice = <M>(h: Html.H<M>) =>
	DescriptionList(h, {
		items: [
			{ term: "Invoice", value: "INV-2026-0412", copy: "INV-2026-0412" },
			{ term: "Due", value: "4 January 2027" },
			{ term: "Amount", value: "€2,400.00" },
		],
	})
```

## Examples

Each example is a complete file. Its imports point where the CLI installs the source.

### Order details

The example the page opens with: Description List in “Order details”.

This example also uses Badge. Install it too:

```sh
npx shadcn@latest add checkfu/uicontext/badge
```

```ts title="src/demo.ts" source="www/src/examples/description-list/demo.ts"
import type { Html } from "effect/ui/html"
import * as stylex from "@stylexjs/stylex"
import { Badge } from "./ui/uicontext/components/Badge.ts"
import { DescriptionList } from "./ui/uicontext/components/DescriptionList.ts"
import { sx } from "./ui/uicontext/components/Sx.ts"

const styles = stylex.create({ wrap: { inlineSize: "min(100%, 36rem)" } })

// an order's details, as a support agent or the customer sees them
export const OrderDetails = <M>(h: Html.H<M>) =>
		h.div.attrs(sx(styles.wrap)).children(
			DescriptionList(h, {
				label: "Order details",
				boxed: true,
				items: [
					{ term: "Order", value: "#10482", copy: "10482" },
					{ term: "Status", value: Badge(h, { tone: "success", dot: true }).children("Shipped") },
					{ term: "Total", value: "$1,284.00", hint: "Paid with Visa ending 4242" },
					{ term: "Ship to", value: "Đặng Thị Ngọc Hân, 18 Rue des Écoles, 75005 Paris, France" },
					{ term: "Tracking", value: "1Z 999 AA1 01 2345 6784", copy: "1Z999AA10123456784" },
				],
			}),
		)
```

### Columns

`layout: "columns"` sets the pairs side by side and wraps them as the space narrows.

This example also uses Badge. Install it too:

```sh
npx shadcn@latest add checkfu/uicontext/badge
```

```ts title="src/columns.ts" source="www/src/examples/description-list/columns.ts"
import type { Html } from "effect/ui/html"
import * as stylex from "@stylexjs/stylex"
import { Badge } from "./ui/uicontext/components/Badge.ts"
import { DescriptionList } from "./ui/uicontext/components/DescriptionList.ts"
import { sx } from "./ui/uicontext/components/Sx.ts"

const styles = stylex.create({ wrap: { inlineSize: "min(100%, 44rem)" } })

// a database's summary at the top of its page: the pairs flow into as many columns as fit
export const DatabaseSummary = <M>(h: Html.H<M>) =>
		h.div.attrs(sx(styles.wrap)).children(
			DescriptionList(h, {
				label: "Database",
				layout: "columns",
				items: [
					{ term: "Status", value: Badge(h, { tone: "success", dot: true }).children("Available") },
					{ term: "Region", value: "eu-central-1", hint: "Frankfurt" },
					{ term: "Engine", value: "Postgres 17.2" },
					{ term: "Size", value: "db.r6g.xlarge", hint: "4 vCPU · 32 GB" },
					{ term: "Storage", value: "412 GB of 1 TB" },
					{ term: "Backups", value: "Daily at 03:00 UTC", hint: "Kept 14 days" },
				],
			}),
		)
```

## API reference

**Options**

| Name | Type | Description |
| --- | --- | --- |
| `items` (required) | `DescriptionItem<Message>[]` | — |
| `layout` | `"rows" \| "columns"` | Label beside value (the default), or pairs in columns. |
| `boxed` | `boolean` | A border around the list, as a card. |
| `label` | `string` | Names the list for screen readers when the heading above doesn't: "Order details". |
| `style` | `Style` | StyleX styles applied after the list's own. |

## Installation

```sh
pnpm dlx shadcn@latest add checkfu/uicontext/description-list
```

With npm: `npx shadcn@latest add checkfu/uicontext/description-list`. With yarn: `yarn dlx shadcn@latest add checkfu/uicontext/description-list`. With bun: `bunx --bun shadcn@latest add checkfu/uicontext/description-list`.

It writes these files:

- `src/ui/uicontext/components/Button.ts`
- `src/ui/uicontext/components/CopyButton.ts`
- `src/ui/uicontext/components/DescriptionList.ts`
- `src/ui/uicontext/components/Sx.ts`
- `src/ui/uicontext/components/button.stylex.ts`
- `src/ui/uicontext/components/tokens.stylex.ts`
- `src/ui/uicontext/components/variants.ts`

And installs the npm packages `@stylexjs/stylex`, `effect`.

## Source

- [src/DescriptionList.ts](https://github.com/checkfu/uicontext/blob/main/src/DescriptionList.ts)

## Related

- [Data Grid](https://uicontext.com/docs/components/data-grid.md) (`data-grid`): A spreadsheet-like grid for editing records, with typed columns, sorting and grouping.
- [Pivot Table](https://uicontext.com/docs/components/pivot-table.md) (`pivot-table`): Records summed two ways, such as revenue by region and quarter, with totals on both edges and cells tinted by size.
- [Table](https://uicontext.com/docs/components/table.md) (`table`): A simple read-only table with a caption, row headers and an empty state.
- [Group Header](https://uicontext.com/docs/components/group-header.md) (`group-header`): The line over a group of rows with its count, sticky while they scroll, folding the group.
- [Fact Grid](https://uicontext.com/docs/components/fact-grid.md) (`fact-grid`): A few numbers about one thing, such as a customer's plan and seats, as small tiles.
- [Order Summary](https://uicontext.com/docs/components/order-summary.md) (`order-summary`): What an order comes to: its lines, then subtotal, discount, shipping, tax and the total.
