Skip to content

DescriptionList

Data Display

Semantic term/value details in one or two responsive columns.

Two-column detailsDivided listMissing value fallback
Open preview

Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.

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
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.

DescriptionList props
PropType / DefaultDescription
itemsDescriptionItem[]

Default: required

Unique terms with optional ReactNode descriptions.
columns1 | 2

Default: 1

Responsive column count.
dividedboolean

Default: false

Separate items with borders.
classNamestring

Default: —

Extend the list layout.

Build with these too