@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) • 882 B
JavaScript
"use client";
;Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@mui/material/FormControlLabel"),t=require("react-hook-form"),o=require("@mui/material/FormGroup"),l=require("@mui/material/Checkbox"),u=require("@mui/material/FormHelperText");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=a(r),n=a(o),s=a(l),c=a(u);exports.FormCheckbox=({label:r,name:o,rules:l,controllerProps:u,checkBoxProps:a,...m})=>{const{control:d}=t.useFormContext();return e.jsx(t.Controller,{name:o,rules:l,control:d,...u,render:({field:t,fieldState:{error:l}})=>e.jsxs(n.default,{children:[e.jsx(i.default,{control:e.jsx(s.default,{...t,checked:t.value,...a,inputProps:{"data-testid":`NexusFormCheckbox-${o}-input`,...a?.inputProps}}),label:r,...m}),l?e.jsx(c.default,{error:!0,children:l?.message}):null]})})};