Form Design Advantages
YH-UI's Form component (especially FormSchema) is not just a simple UI wrapper, but a "high-performance rendering engine" designed for complex business scenarios.
Why Choose YH-UI Form?
1. High Logic Cohesion
In traditional development, form layout, data linkage, and validation logic are often scattered across template, script, and lengthy watch blocks. YH-UI consolidates this logic into a single JSON configuration via FormSchema:
- Declarative Linkage: Calculate UI behavior directly from the current model state using
propsandhiddenfunctions. - Integrated Layout: Built-in 24-column grid system eliminates the need for manual
Row/Colnesting, reducing code volume by approximately 60%.
2. Ultimate Type Safety (DX)
We provide industry-grade TypeScript support for forms:
- Precise Inference: The exported
FormSchemaInstanceprovides complete API autocompletion. - Zero-any Convention: All validation and rendering functions have explicit parameter types, preventing runtime errors.
3. Robustness and Safety
- Ref Fallback Protection: Built-in
footerFormRefproxy solves potential page crashes caused by accessing the instance before the component is mounted. - Auto Type Correction: Automatic type recognition for booleans (Switch) avoids common validation message conflicts.
Advanced Application Example
This example demonstrates the YH-UI form engine's ability to handle complex logic: Dynamic grouping, multi-level linkage, async validation, custom rendering, and full type safety.
Enterprise Onboarding Form