diff options
Diffstat (limited to '')
-rw-r--r-- | extension/src/components/RadioButtonGroup.tsx (renamed from extension/src/RadioButtonGroup.tsx) | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/extension/src/RadioButtonGroup.tsx b/extension/src/components/RadioButtonGroup.tsx index da1b521..297800d 100644 --- a/extension/src/RadioButtonGroup.tsx +++ b/extension/src/components/RadioButtonGroup.tsx @@ -1,12 +1,13 @@ import React, {ReactElement, useEffect, useId, useState} from "react"; -interface RadioProps { - children: ReactElement<HTMLOptionElement>[], - value: any, - onChange?: (arg0: any) => void -} - -function RadioButtonGroup(props: RadioProps) { +/** + * A component for a group of radio buttons where only one can be selected + * + * @param props.children html <option> elements for each radio option + * @param props.value The option which is selected + * @param props.onChange A function that will be called when the selected option changes + */ +function RadioButtonGroup(props: { children: ReactElement<HTMLOptionElement>[], value: any, onChange?: (arg0: any) => void }) { const [selected, setSelected] = useState(props.value); useEffect(() => { setSelected(props.value); |