UNPKG

dgz-ui-shared

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library

25 lines 1.38 kB
import { FormItemProps, RadioGroupItem } from 'dgz-ui/form'; import { default as React } from 'react'; import { FieldValues } from 'react-hook-form'; type RadioItemProps = React.ComponentPropsWithoutRef<typeof RadioGroupItem>; /** * Props for the MyRadio component. * @template TFieldValues - The type of the form values. */ export type MyRadioProps<TFieldValues extends FieldValues> = FormItemProps<TFieldValues> & RadioItemProps; /** * MyRadio is a radio input that can integrate with react-hook-form when control and name are provided. * Falls back to an uncontrolled radio item when not used inside a form. * * @template TFieldValues - Form values type used by react-hook-form. * @param control - The `react-hook-form` control object. * @param name - The name of the field in `react-hook-form`. * @param label - The label to display for the radio input. * @param rules - The `react-hook-form` validation rules. * @param value - The value of the radio input. * @param props - Radio item and form item props. * @returns {JSX.Element | null} A radio button item with form integration, or null if name/control are missing */ declare const MyRadio: <TFieldValues extends FieldValues>({ control, name, label, rules, value, ...props }: MyRadioProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element | null; export { MyRadio }; //# sourceMappingURL=MyRadio.d.ts.map