Skip to main content
Glama
Southclaws

Storyden

by Southclaws
RadioGroupField.tsx1.36 kB
import { RadioGroupValueChangeDetails } from "@ark-ui/react"; import { Controller, ControllerProps, FieldValues } from "react-hook-form"; import * as RadioGroup from "@/components/ui/radio-group"; export type RadioGroupFieldProps<T extends FieldValues> = Omit< ControllerProps<T>, "render" > & { items: RadioGroupItem[]; }; export type RadioGroupItem = { label: string; value: string; }; export function RadioGroupField<T extends FieldValues>({ items, ...controllerProps }: RadioGroupFieldProps<T>) { return ( <Controller<T> {...controllerProps} render={({ field, formState }) => { const defaultValue = formState.defaultValues![ controllerProps.name ] as string; function handleChange({ value }: RadioGroupValueChangeDetails) { field.onChange(value); } return ( <RadioGroup.Root defaultValue={defaultValue} onValueChange={handleChange} > {items.map((item) => ( <RadioGroup.Item key={item.value} value={item.value}> <RadioGroup.ItemControl /> <RadioGroup.ItemText>{item.label}</RadioGroup.ItemText> <RadioGroup.ItemHiddenInput /> </RadioGroup.Item> ))} </RadioGroup.Root> ); }} /> ); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server