Portal Community

Props Contract

interface DesignComponentProps {
  control: FormControl;    // Default config (from plugin's defaultConfig)
}
// No value, onChange, onBlur β€” DesignComponent is purely visual

Two Use Cases

The DesignComponent appears in two places:

Phone Input Design Component

import React from 'react';
import type { DesignComponentProps } from '@atlas-forms/types-js';

export const PhoneDesignComponent: React.FC<DesignComponentProps> = ({ control }) => (
  <div className="design-preview phone-preview">
    <label className="field-label">{control.label || 'Phone Number'}</label>
    <div className="input-mockup">
      <span className="flag-placeholder">πŸ‡ΊπŸ‡Έ</span>
      <span className="input-placeholder">+1 (555) 000-0000</span>
    </div>
  </div>
);

Design Best Practices

When to Omit DesignComponent

If you omit DesignComponent, Form Studio falls back to rendering EditComponent in static mode (no events). This works for most controls. Only provide a custom DesignComponent when the edit component is too heavyweight for design-mode rendering (e.g., it makes API calls on mount).