Hero Hook Form API / RadioGroupFieldProps
Type Alias: RadioGroupFieldProps<TFieldValues, TValue>
RadioGroupFieldProps<
TFieldValues,TValue> =FieldBaseProps<TFieldValues,TValue> &WithControl<TFieldValues> &object
Defined in: fields/RadioGroupField.tsx:58
Props for the RadioGroupField component.
Type Declaration
options
options: readonly
RadioOption<TValue>[]
Array of radio options
radioGroupProps?
optionalradioGroupProps:Omit<React.ComponentProps<typeofRadioGroup>,"value"|"onValueChange"|"label">
Additional props to pass to the underlying RadioGroup component
Type Parameters
TFieldValues
TFieldValues extends FieldValues
The form data type
TValue
TValue extends string | number = string
The value type for the radio group (string or number)
Example
import { RadioGroupField } from "@rachelallyson/hero-hook-form";
import { useForm } from "react-hook-form";
const form = useForm({
defaultValues: { plan: "" },
});
const options = [
{ label: "Basic", value: "basic" },
{ label: "Pro", value: "pro" },
{ label: "Enterprise", value: "enterprise" },
];
<RadioGroupField
control={form.control}
name="plan"
label="Select Plan"
options={options}
/>