import type { JSX } from 'solid-js'; import { createId } from '~/lib/hooks/id'; import type { BoundInputEvent } from './_types'; interface RadioInputProps { label: JSX.Element; blurb?: JSX.Element; name?: string; required?: boolean; value?: T; options: { value: NoInfer; label: string; disabled?: boolean }[]; onChange?: (next: NoInfer, event: BoundInputEvent) => void; } const RadioInput = (props: RadioInputProps) => { const fieldId = createId(); const onChange = props.onChange; const hasValue = 'value' in props; return (
{props.label} {props.options.map(({ value, label, disabled }, idx) => { const optionId = fieldId + idx; return (
onChange?.(value, event)} />
); })}

{props.blurb}

); }; export default RadioInput;