Description List
FreeNewLabel and value pairs that sit in two columns when there is room and stack when there is not, by container width.
Installation
pnpm dlx shadcn@latest add @viewport/description-list
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above.
import { Badge } from "@/components/viewport/badge";
import { DescriptionItem, DescriptionList } from "@/components/viewport/description-list";
export default function DescriptionListDemo() {
return (
<div className="w-full max-w-md rounded-2xl border border-border bg-card px-5 py-2">
<DescriptionList>
<DescriptionItem term="Company">Northwind Trading AB</DescriptionItem>
<DescriptionItem term="Stage">
<Badge tone="info" dot>
Negotiation
</Badge>
</DescriptionItem>
<DescriptionItem term="Owner">Theo Okafor</DescriptionItem>
<DescriptionItem term="Billing email">
<a href="mailto:accounts-payable@northwind-trading.example" className="rounded-sm underline decoration-border underline-offset-4 outline-none hover:decoration-foreground focus-visible:ring-2 focus-visible:ring-ring">
accounts-payable@northwind-trading.example
</a>
</DescriptionItem>
<DescriptionItem term="Notes">Procurement needs the security questionnaire before the legal review can start.</DescriptionItem>
</DescriptionList>
</div>
);
}Props
| Prop | Type | Default |
|---|---|---|
| term* | React.ReactNodeThe label. | — |
| children* | React.ReactNodeThe value. | — |
Accessibility
- Rendered as dl, dt and dd, so pairs are announced together.
- Long values such as email addresses wrap instead of overflowing.
- Server component with no client JavaScript.