Registry UI Widgets: Complete guide and reference
Learn how to build dynamic forms from JSON configurations using the OpenG2P Registry UI Widgets library. This comprehensive guide covers everything from basic setup to advanced customization, includin
Table of contents
Introduction
Installation and setup
Step 1: Install the package
Step 2: Install peer dependencies
Step 3: Basic setup
Step 4: Initialize i18n (optional but recommended)
Core concepts
1. Widget configuration
2. useBaseWidget Hook
3. Widget registry
Basic usage
Rendering a single widget
Rendering multiple widgets with layout
Using sections and panels
Widget Configuration
Basic configuration properties
Example: complete text input configuration
Data binding
Single path binding
Multi-path binding
Accessing data
Getting other field values
Validation
Built-in validation rules
Predefined validation types
Custom regex patterns
Zod schema validation
Validation example: email with custom rules
Manual validation
Conditional Logic
Show/hide widgets
Enable/disable widgets
Available operators
Complex conditional example
Data sources
Static data source
API Data Source
Dependent API data source
Schema reference data source
API adapter setup
Formatting
Date formatting
Currency formatting
Number formatting
Text formatting
Phone number formatting
Widget reference
Input widgets
1. Text Input Widget (text)
text)2. Text Area Widget (textarea)
textarea)3. Number Input Widget (number)
number)4. Currency Input Widget (currency)
currency)5. Phone Input Widget (phone)
phone)6. Date Input Widget (date)
date)7. DateTime Input Widget (datetime)
datetime)8. File Input Widget (file)
file)Selection widgets
9. Select Widget (select)
select)10. Radio Widget (radio)
radio)11. Checkbox Widget (checkbox)
checkbox)12. Boolean Widget (boolean)
boolean)Layout widgets
13. Array Widget (array-widget)
array-widget)14. Iterable Accordion Widget (iterable-accordion)
iterable-accordion)Display widgets
15. Display Widget (display)
display)16. Profile Widget (profile)
profile)Table widgets
17. Table Widget (table)
table)18. Simple Table Widget (simple-table)
simple-table)Widget configuration summary
Creating custom widgets
Step 1: Create the widget component
Step 2: Register the widget
Step 3: Use the widget
Advanced custom widget example
Advanced patterns
Multi-step forms
Dynamic form generation
Form validation on submit
Array widgets
Internationalization
Automatic translation loading (default behavior)
Override methods
Method 1: Manual initialization with custom resources
Method 2: Custom load path
Method 3: Using translate prop in WidgetProvider
Method 4: Translating widget labels programmatically
Using translation in custom widgets
Summary
Best practices
1. Widget IDs
2. Data paths
3. Validation
4. Conditional logic
5. Data sources
6. Performance
7. Type safety
Troubleshooting
Widget not rendering
Validation not working
Data not updating
API data source not loading
Conditional logic not working
TypeScript Errors
Conclusion
Last updated
Was this helpful?

