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) 703 B
"use client"; import{jsx as r,jsxs as o}from"react/jsx-runtime";import e from"@mui/material/FormControlLabel";import{useFormContext as t,Controller as m}from"react-hook-form";import l from"@mui/material/FormGroup";import i from"@mui/material/Checkbox";import a from"@mui/material/FormHelperText";const n=({label:n,name:c,rules:p,controllerProps:u,checkBoxProps:s,...f})=>{const{control:d}=t();return r(m,{name:c,rules:p,control:d,...u,render:({field:t,fieldState:{error:m}})=>o(l,{children:[r(e,{control:r(i,{...t,checked:t.value,...s,inputProps:{"data-testid":`NexusFormCheckbox-${c}-input`,...s?.inputProps}}),label:n,...f}),m?r(a,{error:!0,children:m?.message}):null]})})};export{n as FormCheckbox};