@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.
3 lines (2 loc) • 551 B
JavaScript
"use client";
import{jsx as r}from"react/jsx-runtime";import{useFormContext as e,Controller as t}from"react-hook-form";import o from"@mui/material/TextField";const l=({name:l,rules:i,controllerProps:n,...s})=>{const{control:a}=e();return r(t,{control:a,name:l,rules:i,...n,render:({field:{ref:e,...t},fieldState:{error:i}})=>r(o,{...s,inputRef:e,...t,helperText:i?i.message:null,error:!!i,slotProps:{input:{inputProps:{"aria-label":l,"data-testid":`NexusFormInput-${l}`}},inputLabel:{required:s.required},...s?.slotProps}})})};export{l as FormInput};