A record's facts as label and value pairs, in rows or columns, with Copy for ids.
- 3.0 kB JS 4.1 kB CSS gzipped
- No serious axe issues
- Server-rendered, hydrates
- 44px touch targets
- Right-to-left
- Order
- #10482
- Status
- Shipped
- Total
- $1,284.00Paid with Visa ending 4242
- Ship to
- Đặng Thị Ngọc Hân, 18 Rue des Écoles, 75005 Paris, France
- Tracking
- 1Z 999 AA1 01 2345 6784
This example also uses Badge. Install it too:
npx shadcn@latest add checkfu/uicontext/badgeimport 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 themexport 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" }, ], }), )When to use
A record's facts as label and value pairs, in rows or columns, with Copy for ids. Use Record Detail instead when people edit the fields in place.
Usage
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
Columns
layout: "columns" sets the pairs side by side and wraps them as the space narrows.
- Status
- Available
- Region
- eu-central-1Frankfurt
- Engine
- Postgres 17.2
- Size
- db.r6g.xlarge4 vCPU · 32 GB
- Storage
- 412 GB of 1 TB
- Backups
- Daily at 03:00 UTCKept 14 days
This example also uses Badge. Install it too:
npx shadcn@latest add checkfu/uicontext/badgeimport 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 fitexport 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 |
|---|---|---|
itemsrequired | 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
pnpm dlx shadcn@latest add checkfu/uicontext/description-list