Skip to main content

RadioGroup

A group of radio buttons.

Usage

import { RadioGroup } from "@fedibtc/ui"
import { useState } from "react"

function MyComponent() {
const [radioGroupValue, setRadioGroupValue] = useState("one")

const groupOptions = [
{
label: "Group option one",
value: "one"
},
{
label: "Group option two",
value: "two"
},
{
label: "Group option three",
value: "three",
disabled: true
}
]

return (
<div>
<RadioGroup
options={groupOptions}
value={radioGroupValue}
onChange={setRadioGroupValue}
/>
</div>
)
}

Props

NameTypeDescription
optionsreadonly RadioOption[]An array of radio options
valuestringThe value of the Radio Group. Must match an enumerated value in options
disabledbooleanWhether the group is disabled
labelTextPropsTextPropsAdditional props to apply to the label text.
onChange(value: string) => voidA function that is called when the radio group value is changed

Types

RadioOption

export interface RadioOption {
value: string
label: string
disabled?: boolean
}