@nexusui/components
Version:
These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.
36 lines (35 loc) • 1.13 kB
TypeScript
import { FC } from 'react';
import { StackProps } from '@mui/material/Stack';
import { FormField } from './type';
/** The props type of [[`IConditionalForm`]]. */
export interface IConditionalForm extends StackProps {
/**
* condition for the form
* @default true
*/
visible?: boolean | (() => boolean);
/**
* fields for the form component, is array, value type is FormField
*
* ```
* type FormField = {
* id: string;
* label: string;
* name: string;
* type: SupportedComponent;
* options?: OptionType[];
* rules?: UseControllerProps['rules'];
* properties?: Record<string, any>;
* }
* type SupportedComponent = 'text' | 'select' | 'checkbox' | 'radio' | 'switch';
* ```
*
*/
fields: ReadonlyArray<FormField>;
}
/**
* Conditional Form component, used to show configured form
* @param {IConditionalForm} props - provides the properties fo React component
* @return {ReactElement<any, any> | null} - provides the react component to be ingested
**/
export declare const ConditionalForm: FC<IConditionalForm>;