Skip to main content

DTabs

Tabbed interface component with multiple variants and styles.

Basic Usage

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

function App() {
  const options = [
    { label: 'Home', tab: 'home' },
    { label: 'Profile', tab: 'profile' },
    { label: 'Settings', tab: 'settings' },
  ];
  
  return (
    <DTabs 
      options={options} 
      defaultSelected="home"
      onChange={(option) => console.log(option)}
    >
      <DTabs.Tab id="home">
        <h3>Home Content</h3>
      </DTabs.Tab>
      <DTabs.Tab id="profile">
        <h3>Profile Content</h3>
      </DTabs.Tab>
      <DTabs.Tab id="settings">
        <h3>Settings Content</h3>
      </DTabs.Tab>
    </DTabs>
  );
}

Props

options
Array<DTabOption>
required
Array of tab options
defaultSelected
string
required
Initially selected tab ID
onChange
(option: DTabOption) => void
Called when tab selection changes
variant
TabVariant
default:"underline"
Tab style - ‘tabs’, ‘pills’, ‘underline’, or ‘toggle-button-group’
vertical
boolean
default:"false"
Vertical tab layout
classNameTab
string
Additional classes for tab buttons

DTabOption Interface

label
string | ReactNode
required
Tab label text or element
tab
string
required
Unique tab identifier
disabled
boolean
Disables the tab

Examples

const options = [
  { label: 'Overview', tab: 'overview' },
  { label: 'Transactions', tab: 'transactions' },
  { label: 'Documents', tab: 'documents' },
];

<DTabs options={options} defaultSelected="overview" variant="tabs">
  <DTabs.Tab id="overview">
    Account overview content
  </DTabs.Tab>
  <DTabs.Tab id="transactions">
    Transaction history
  </DTabs.Tab>
  <DTabs.Tab id="documents">
    Document list
  </DTabs.Tab>
</DTabs>

TypeScript Interface

export type DTabOption = {
  label: string | React.ReactNode;
  tab: string;
  disabled?: boolean;
};

export type TabVariant = 'tabs' | 'pills' | 'underline' | 'toggle-button-group';

type Props = BaseProps & PropsWithChildren<{
  classNameTab?: string;
  onChange?: (option: DTabOption) => void;
  options: Array<DTabOption>;
  defaultSelected: string;
  vertical?: boolean;
  variant?: TabVariant;
}>;

DPaginator

Responsive pagination component powered by react-responsive-pagination.

Basic Usage

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

function App() {
  const [currentPage, setCurrentPage] = useState(1);
  
  return (
    <DPaginator 
      current={currentPage}
      total={10}
      onPageChange={setCurrentPage}
    />
  );
}

Props

Inherits all props from react-responsive-pagination:
current
number
required
Current page number (1-indexed)
total
number
required
Total number of pages
onPageChange
(page: number) => void
required
Called when page changes
maxWidth
number
Maximum number of page buttons to show
navClassName
string
Additional classes for nav element

Examples

const [page, setPage] = useState(1);

<DPaginator 
  current={page}
  total={20}
  onPageChange={setPage}
/>

TypeScript Interface

export type Props = ResponsivePaginationProps & {
  dataAttributes?: DataAttributes;
};

DStepper

Step indicator component for multi-step processes with responsive mobile/desktop views.

Basic Usage

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

function App() {
  const [currentStep, setCurrentStep] = useState(1);
  
  const steps = [
    { label: 'Personal Info', value: 1, description: 'Basic information' },
    { label: 'Address', value: 2, description: 'Contact details' },
    { label: 'Review', value: 3, description: 'Confirm details' },
  ];
  
  return (
    <DStepper 
      options={steps}
      currentStep={currentStep}
    />
  );
}

Props

options
Array<Step>
required
Array of step configurations
currentStep
number
required
Current active step number
vertical
boolean
default:"false"
Vertical layout (desktop only)
completed
boolean
default:"false"
Marks all steps as completed
breakpoint
BreakpointSize
default:"lg"
Breakpoint for switching between mobile and desktop views
iconSuccess
string
Custom icon for completed steps

Step Interface

label
string
required
Step label
value
number
required
Step number/value
description
string
Step description

Examples

function CheckoutStepper() {
  const [step, setStep] = useState(1);
  
  const steps = [
    { label: 'Cart', value: 1 },
    { label: 'Shipping', value: 2 },
    { label: 'Payment', value: 3 },
    { label: 'Confirmation', value: 4 },
  ];
  
  return (
    <>
      <DStepper options={steps} currentStep={step} />
      
      <div className="mt-4">
        {/* Step content */}
        <DButton 
          text="Next"
          onClick={() => setStep(step + 1)}
          disabled={step === steps.length}
        />
      </div>
    </>
  );
}

TypeScript Interface

export type Step = {
  label: string;
  value: number;
  description?: string;
};

type Props = BaseProps & {
  options: Array<Step>;
  currentStep: number;
  iconSuccess?: string;
  iconSuccessFamilyClass?: string;
  iconSuccessFamilyPrefix?: string;
  iconSuccessMaterialStyle?: boolean;
  vertical?: boolean;
  completed?: boolean;
  breakpoint?: BreakpointSize;
};

Build docs developers (and LLMs) love