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) 635 B
"use client"; import{createElement as r}from"react";import{jsx as o}from"react/jsx-runtime";import t from"@mui/material/FormControlLabel";import i from"@mui/material/Radio";import m from"@mui/material/RadioGroup";import{useFormContext as e,Controller as a}from"react-hook-form";const p=({name:p,rules:n,options:l,controllerProps:u,radioProps:s,...c})=>{const{control:d}=e();return o(a,{...u,control:d,name:p,rules:n,render:({field:e})=>o(m,{...c,...e,role:"radiogroup",children:l.map((m=>r(t,{...m,key:m.value,control:o(i,{...s,inputProps:{"data-testid":`NexusFormRadio-${p}-input`,...s?.inputProps}})})))})})};export{p as FormRadio};