Rev 3549 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import React from 'react';import { FormControl, FormHelperText, FormLabel, Rating } from '@mui/material';import { Controller, useFormContext } from 'react-hook-form';export function FormInputRating({ name = 'rating', label = '', rules = {}, readOnly = false }) {const { control } = useFormContext();return (<Controllercontrol={control}name={name}rules={rules}render={({ field, fieldState: { error } }) => (<FormControl error={!!error}>{label && <FormLabel shrink>{label}</FormLabel>}<RatingonChange={field.onChange}value={field.value}sx={{ fontSize: 20 }}readOnly={readOnly}/>{error && <FormHelperText error={!!error}>{error.message}</FormHelperText>}</FormControl>)}/>);}