1.5.5 • Published 11 months ago
tp-react-elements-dev v1.5.5
How to use the Library
This Library is a reusable component gives intialvalues and validation schema for useForm and you can render Form Field Components without adding any text fields.
import { yupResolver } from "@hookform/resolvers/yup";
import { useForm } from "react-hook-form";
import { RenderForm, useFormValidatingContext } from "tp-react-elements-dev";
import { FormSectionPropsItem } from "tp-react-elements-dev/dist/components/Form/FormRender";
const App = () => {
const formArray:FormSectionPropsItem[]= [
{
name: "userName",
label: "User Name",
inputType: "text",
required: true,
errorMessage: "Please enter",
},
{
name: "password",
label: "Password",
inputType: "number",
required: true,
errorMessage: "Please enter",
},
{
name: "date",
label: "Password",
inputType: "datepicker",
required: true,
errorMessage: "Please select message",
minDate:'30/06/2024',
maxDate:'22/07/2024'
},
{
name: "password1",
label: "Password New",
inputType: "password",
required: true,
errorMessage: "Please select message",
},
{
name: "daterange",
label: "Password",
required:true,
inputType: "multiselect",
options:[]
},
{
name: "daterangepicker",
label: "Date range Picker",
required:true,
inputType: "dateRangePicker",
monthSpan:1
},
{
name: "status",
label: "sdf",
inputType: "toggleSwitch",
monthSpan:1
},
{
name: "yearpicker",
label: "Year",
required:true,
inputType: "yearpicker",
monthSpan:1
},
{
name: "monthpicker",
label: "Month Picker",
required:true,
inputType: "monthpicker",
monthSpan:1
},
{
name: "file",
label: "File Upload",
required:true,
inputType: "file",
monthSpan:1
},
];
const { initialValues, validationSchema } = useFormValidatingContext(
formArray
);
const form=useForm({
defaultValues:initialValues,
resolver:yupResolver(validationSchema)
})
return (
<RenderForm formArray={formArray} name={"form1"} form={form} numberOfColumns={2} />
)
}
export default App
1.5.5
11 months ago
1.5.4
11 months ago
1.5.3
12 months ago
1.5.2
12 months ago
1.5.1
12 months ago
1.5.0
12 months ago
1.4.9
1 year ago
1.4.11
1 year ago
1.4.8
1 year ago
1.4.10
1 year ago
1.4.13
1 year ago
1.4.15
1 year ago
1.4.14
1 year ago
1.4.16
1 year ago
1.4.7
1 year ago
1.4.5
1 year ago
1.4.4
1 year ago
1.4.2
1 year ago
1.4.1
1 year ago
1.4.0
1 year ago
1.3.0
1 year ago
1.2.0
1 year ago
1.1.0
1 year ago
1.0.0
1 year ago
0.4.0
1 year ago
0.3.0
1 year ago
0.2.0
1 year ago
0.1.0
1 year ago
0.0.0
1 year ago
1.4.3
1 year ago