Skip to main content

DAvatar

User avatar component with image or initials support.

Basic Usage

import DAvatar from '@dynamic-framework/ui-react';

function App() {
  return (
    <DAvatar 
      name="John Doe"
      image="https://example.com/avatar.jpg"
    />
  );
}

Props

name
string
User name (used for initials if no image provided)
image
string
Avatar image URL
size
AvatarSize
Avatar size - ‘xs’, ‘sm’, ‘lg’, ‘xl’, or ‘xxl’
useNameAsInitials
boolean
default:"false"
If true, displays full name instead of extracted initials

Examples

<DAvatar 
  name="Jane Smith"
  image="https://api.dicebear.com/7.x/avataaars/svg?seed=Jane"
/>

TypeScript Interface

type Props =
& BaseProps
& {
  id?: string;
  size?: AvatarSize;
  image?: string;
  name?: string;
  useNameAsInitials?: boolean;
};

DBadge

Badge component for labels and status indicators.

Basic Usage

import DBadge from '@dynamic-framework/ui-react';

function App() {
  return (
    <DBadge text="New" color="primary" />
  );
}

Props

text
string
Badge text content
color
ComponentColor
default:"primary"
Badge color
soft
boolean
default:"false"
Uses soft color variant
size
'sm' | 'lg'
Badge size
rounded
boolean
default:"false"
Makes badge pill-shaped
iconStart
string
Icon at start of badge
iconEnd
string
Icon at end of badge

Examples

<DBadge text="Primary" color="primary" />
<DBadge text="Success" color="success" />
<DBadge text="Danger" color="danger" />
<DBadge text="Warning" color="warning" />
<DBadge text="Info" color="info" />

DCurrencyText

Formatted currency display using the useFormatCurrency hook.

Basic Usage

import DCurrencyText from '@dynamic-framework/ui-react';

function App() {
  return (
    <DCurrencyText value={1234.56} />
  );
}

Props

value
number
required
Numeric value to format as currency
className
string
Additional CSS classes
style
CSSProperties
Inline styles

Example

// Displays formatted currency based on locale settings
<DCurrencyText value={1234.56} />
// Output: $1,234.56 (example for USD)

<DCurrencyText 
  value={9999.99} 
  className="text-success fw-bold"
/>

TypeScript Interface

type Props = BaseProps & {
  value: number;
};

DCreditCard

Credit card display component with brand logos and customization.

Basic Usage

import DCreditCard from '@dynamic-framework/ui-react';

function App() {
  return (
    <DCreditCard 
      brand="visa"
      number="**** **** **** 1234"
      name="John Doe"
    />
  );
}

Props

brand
CardBrand
default:"visa"
Card brand - ‘visa’ or ‘mastercard’
number
string
Card number (typically masked)
name
string
Cardholder name
holderText
string
default:"Card Holder"
Label for cardholder name
isChipVisible
boolean
default:"true"
Shows chip image
isVertical
boolean
default:"false"
Vertical card layout
logoImage
string
Custom logo image URL (overrides brand logo)

Examples

<DCreditCard 
  brand="visa"
  number="**** **** **** 4532"
  name="Jane Smith"
/>

TypeScript Interface

type CardBrand = 'visa' | 'mastercard';

type Props = {
  className?: string;
  brand?: CardBrand;
  isChipVisible?: boolean;
  name?: string;
  number?: string;
  holderText?: string;
  isVertical?: boolean;
  logoImage?: string;
};

DVoucher

Voucher/receipt component with share and download functionality.

Basic Usage

import DVoucher from '@dynamic-framework/ui-react';

function App() {
  return (
    <DVoucher
      title="Payment Successful"
      message="Your transaction has been completed"
      amount="$1,234.56"
    >
      <div>
        <p><strong>Transaction ID:</strong> TXN-12345</p>
        <p><strong>Date:</strong> March 3, 2026</p>
      </div>
    </DVoucher>
  );
}

Props

title
string
required
Voucher title
message
string
required
Voucher message
amount
string
Amount to display prominently
amountDetails
ReactNode
Additional details below amount
icon
false | null | string | Partial<ComponentProps<typeof DIcon>>
Icon configuration (defaults to success checkmark)
downloadText
string
default:"Download"
Download button text
shareText
string
default:"Share"
Share button text
onError
(err: Error) => Promise<void> | void
Error handler for share/download failures

Examples

<DVoucher
  title="Payment Successful"
  message="Your payment has been processed"
  amount="$250.00"
  amountDetails={
    <small className="text-muted">Includes $10.00 processing fee</small>
  }
>
  <div>
    <p><strong>Payment Method:</strong> Visa ****1234</p>
    <p><strong>Reference:</strong> PAY-ABC-123</p>
    <p><strong>Date:</strong> March 3, 2026</p>
  </div>
</DVoucher>

TypeScript Interface

type Props = PropsWithChildren<{
  amount?: string;
  amountDetails?: ReactNode;
  icon?: false | null | string | Partial<ComponentProps<typeof DIcon>>;
  className?: string;
  message: string;
  title: string;
  downloadText?: string;
  shareText?: string;
  onError?: (err: Error) => Promise<void> | void;
}>;

DTimeline

Timeline component for displaying sequential events.

Basic Usage

import DTimeline from '@dynamic-framework/ui-react';

function App() {
  const items = [
    {
      title: 'Order Placed',
      description: 'Your order has been received',
      time: '10:00 AM',
      status: 'success' as const,
      icon: 'check-circle'
    },
    {
      title: 'Processing',
      description: 'Order is being prepared',
      time: '10:30 AM',
      status: 'info' as const,
      icon: 'clock'
    },
  ];
  
  return <DTimeline items={items} />;
}

Props

items
DTimelineItem[]
required
Array of timeline items

DTimelineItem Interface

title
string
required
Item title
description
string
Item description
time
string
Timestamp or time label
icon
string
Bootstrap icon name (without ‘bi-’ prefix)
status
'success' | 'warning' | 'danger' | 'info'
Status color variant
children
ReactNode
Custom content for the item

Examples

const orderTimeline = [
  {
    title: 'Order Placed',
    description: 'Order #12345 received',
    time: 'March 1, 10:00 AM',
    status: 'success',
    icon: 'check-circle'
  },
  {
    title: 'Payment Confirmed',
    description: 'Payment processed successfully',
    time: 'March 1, 10:05 AM',
    status: 'success',
    icon: 'credit-card'
  },
  {
    title: 'Preparing',
    description: 'Your order is being prepared',
    time: 'March 1, 11:00 AM',
    status: 'info',
    icon: 'box'
  },
  {
    title: 'Shipped',
    description: 'Package dispatched',
    time: 'March 2, 09:00 AM',
    status: 'warning',
    icon: 'truck'
  },
];

<DTimeline items={orderTimeline} />

TypeScript Interface

export type DTimelineItem = {
  title: string;
  description?: string;
  time?: string;
  icon?: string;
  status?: 'success' | 'warning' | 'danger' | 'info';
  children?: React.ReactNode;
};

type Props = BaseProps & {
  items: DTimelineItem[];
};

Build docs developers (and LLMs) love