Open this example in the interactive library
Live preview
Source code
// components/RadioOptionGroup.tsx
import { useId } from "react";
export default function RadioOptionGroup({
options = ["Clay", "Slate", "Ink"],
}: { options?: string[] } = {}) {
const name = useId();
return (
<fieldset>
<legend>Choose a finish</legend>
{options.map((value) => (
<label key={value}>
<input type="radio" name={name} value={value} />
{value}
</label>
))}
</fieldset>
);
}
