DescriptionList
Data DisplaySemantic term/value details in one or two responsive columns.
Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.
"use client";
import { DescriptionList } from "@/components/ui/description-list";
import { Badge } from "@dashboardpack/core/components/ui/badge";
export default function DescriptionListExample() {
return (
<div className="w-full max-w-md space-y-5">
<DescriptionList
columns={2}
items={[
{ term: "Customer", description: "Alex Morgan" },
{
term: "Order status",
description: <Badge variant="success">Paid</Badge>,
},
{ term: "Invoice", description: "INV-2026-1024" },
{ term: "Total", description: "$240.00" },
]}
/>
<div className="border-t pt-3">
<DescriptionList
divided
items={[
{
term: "Shipping address",
description: "42 Oak Street, Riga, Latvia",
},
{ term: "Delivery instructions" },
]}
/>
</div>
</div>
);
}Usage
Provide unique terms and their descriptions. Descriptions can include text, badges, links, or other appropriate content. Missing descriptions display a clear fallback. columns=2 becomes a single column on small screens.
import { DescriptionList } from "@/components/ui/description-list";Shipped as editable source in src/components/ui/description-list.tsx in both apps. Copy the implementation below when moving it to another project. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.
Component source
The complete implementation is included in both apps. It uses the React, Radix, Lucide, and shared-core dependencies already installed in Apex. Keep your project’s semantic theme tokens when reusing it.
src/components/ui/description-list.tsx
import type { ReactNode } from "react";
import { cn } from "@dashboardpack/core/lib/utils";
export interface DescriptionItem {
term: string;
description?: ReactNode;
}
export function DescriptionList({
items,
columns = 1,
divided = false,
className,
}: {
items: DescriptionItem[];
columns?: 1 | 2;
divided?: boolean;
className?: string;
}) {
return (
<dl
className={cn(
"grid gap-x-8",
columns === 2 && "sm:grid-cols-2",
className,
)}
>
{items.map((item) => (
<div
key={item.term}
className={cn(
"space-y-1 py-3",
divided && "border-b last:border-b-0",
)}
>
<dt className="text-xs font-medium text-muted-foreground">
{item.term}
</dt>
<dd className="text-sm text-foreground">
{item.description ?? (
<span className="text-muted-foreground">Not provided</span>
)}
</dd>
</div>
))}
</dl>
);
}API reference
Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.
| Prop | Type / Default | Description |
|---|---|---|
| items | DescriptionItem[]Default: required | Unique terms with optional ReactNode descriptions. |
| columns | 1 | 2Default: 1 | Responsive column count. |
| divided | booleanDefault: false | Separate items with borders. |
| className | stringDefault: — | Extend the list layout. |