df-forms-preview-pack
v1.0.0
Published
A comprehensive React form preview component library with form controls, validation, conditional logic, and responsive design
Downloads
107
Maintainers
Readme
df-forms-preview-pack
A comprehensive React form preview component library with form controls, validation, conditional logic, drag-and-drop, and responsive design.
Installation
npm install df-forms-preview-packPeer Dependencies
This package requires the following peer dependencies:
npm install react react-domQuick Start
1. Import Theme Variables
First, import the theme file to provide CSS variables:
import 'df-forms-preview-pack/theme.scss';
// OR define your own CSS variables (see CSS_VARIABLES.md)2. Use Components
import { DfFormPreview, DfFormInput, DfFormSection } from 'df-forms-preview-pack';
function App() {
const formComponents = [
{
id: '1',
name: 'text-input',
basic: {
label: 'Name',
placeholder: 'Enter your name'
},
validation: {
required: true
}
}
];
return (
<DfFormPreview
formComponents={formComponents}
currentDevice="desktop"
isPreviewMode={false}
/>
);
}Available Components
Form Controls
DfFormInput- Text, number, and email inputsDfFormTextarea- Multi-line text inputDfFormSelect- Dropdown selectDfFormCheckbox- Checkbox inputDfFormRadio- Radio button inputDfFormSegment- Segmented controlDfFormDateTime- Date and time pickerDfFormSignature- Signature padDfFormFileUpload- File uploadDfFormLocation- Location pickerDfFormHeading- Heading/TitleDfFormInstruction- Instruction textDfFormComments- Comments componentDfFormErrorMsg- Error message display
Container Components
DfFormSection- Section container with collapsible contentDfFormTable- Table layout with cellsDfFormDataGrid- Grid layout for form components
Main Component
DfFormPreview- Main preview component that renders all form components
Additional Components
ComponentActionFeatures- Action features for componentsThresholdAlert- Threshold validation alertsRaiseIssueModal- Modal for raising issues
CSS Variables
This package uses CSS variables for theming. See CSS_VARIABLES.md for a complete list of required variables, or import theme.scss for default values.
Features
- ✅ Form Controls: 14+ form control components
- ✅ Validation: Built-in validation with error messages
- ✅ Conditional Logic: Show/hide components based on conditions
- ✅ Drag & Drop: Reorder components with drag-and-drop
- ✅ Responsive Design: Mobile, tablet, and desktop views
- ✅ Dark Mode: Full dark mode support
- ✅ TypeScript: Full TypeScript support with type definitions
- ✅ Accessible: ARIA labels and keyboard navigation
Documentation
License
MIT
