UNPKG

@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) 684 B
"use client"; "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react-hook-form");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=t(require("@mui/material/TextField"));exports.FormInput=({name:t,rules:u,controllerProps:l,...n})=>{const{control:s}=r.useFormContext();return e.jsx(r.Controller,{control:s,name:t,rules:u,...l,render:({field:{ref:r,...u},fieldState:{error:l}})=>e.jsx(o.default,{...n,inputRef:r,...u,helperText:l?l.message:null,error:!!l,slotProps:{input:{inputProps:{"aria-label":t,"data-testid":`NexusFormInput-${t}`}},inputLabel:{required:n.required},...n?.slotProps}})})};