Skip to main content
The DescriptionCard component is designed for displaying structured document information like orders, invoices, products, and customer details. It provides automatic field rendering based on data types with responsive layouts.

Import

Basic Usage

Props

Record<string, unknown>
required
Raw data object containing all field values. The component extracts values using the key paths defined in fields.
string
required
Card title displayed in the header section
FieldConfig[]
required
Array of field configurations and dividers. Each field defines how to extract and display a value from the data object.See Field Types for available field configurations.
3 | 4
default:"3"
Number of columns to display on desktop. The layout automatically responds to container width:
  • 3 columns: 1 → 2 → 3 columns (at 400px, 600px breakpoints)
  • 4 columns: 1 → 2 → 3 → 4 columns (at 400px, 600px, 800px breakpoints)
string
Additional CSS classes for custom styling
React.ReactNode
Action component displayed in the card header (e.g., an Edit button)

Field Types

The DescriptionCard supports 7 specialized field types, each with specific rendering and metadata options.

Text Field (default)

Standard text display with optional copy functionality and truncation.

Badge Field

Displays values as colored status badges with automatic variant mapping.
Features:
  • Automatically converts values to sentence case (“CONFIRMED” → “Confirmed”)
  • Falls back to neutral variant if value not in map
  • See Badge component for available variants

Money Field

Formats currency values with proper locale formatting.
Example data:
Displays: $1,234.56

Date Field

Formats date/timestamp values with multiple format options.
Format examples:
  • short: 12/25/2023
  • medium: Dec 25, 2023
  • long: December 25, 2023
  • relative: 2 days ago
Renders clickable links with optional external icon.

Reference Field

Displays a value with a link to a related document.

Address Field

Displays multi-line address information (always takes full width).
Expects address object with:

Field Configuration Options

Nested Data Access

Use dot notation to access nested properties:

Empty Value Handling

Control how empty/null/undefined values are displayed:
  • "dash" (default): Shows ”—” for empty values
  • "hide": Completely hides the field if value is empty

Section Dividers

Add visual separators between groups of fields:

Complete Example

Responsive Behavior

The DescriptionCard uses CSS container queries to respond to its container width (not viewport width). This ensures correct behavior when placed in narrow containers or sidebars. 3 Column Mode (default):
  • Container < 400px: 1 column
  • Container 400px - 599px: 2 columns
  • Container ≥ 600px: 3 columns
4 Column Mode:
  • Container < 400px: 1 column
  • Container 400px - 599px: 2 columns
  • Container 600px - 799px: 3 columns
  • Container ≥ 800px: 4 columns

TypeScript

The component exports comprehensive TypeScript types:

Common Patterns

Multi-Currency Support

Dynamic Status Badges

Conditional Field Display