UNPKG

@neynar/ui

Version:

React UI component library built on shadcn/ui and Tailwind CSS

66 lines (54 loc) 1.97 kB
# ContextMenuRadioGroup **Type**: component ContextMenuRadioGroup - Container for radio button items Groups radio items together to allow single selection from multiple options. Manages the selected state and ensures only one item can be selected at a time. Provides controlled state management for radio selections within menus. ## JSX Usage ```jsx import { ContextMenuRadioGroup } from '@neynar/ui'; <ContextMenuRadioGroup value="value" onValueChange={handleValueChange} className="value" > {/* Your content here */} </ContextMenuRadioGroup> ``` ## Component Props ### value - **Type**: `string` - **Required**: No - **Description**: The currently selected value that matches a RadioItem's value ### onValueChange - **Type**: `(value: string) => void` - **Required**: No - **Description**: Callback fired when selection changes, receives new value ### className - **Type**: `string` - **Required**: No - **Description**: No description available ### children - **Type**: `React.ReactNode` - **Required**: Yes - **Description**: ContextMenuRadioItem components to group together ## Examples ### Example 1 ```tsx const [theme, setTheme] = useState("light") <ContextMenuRadioGroup value={theme} onValueChange={setTheme}> <ContextMenuRadioItem value="light">Light</ContextMenuRadioItem> <ContextMenuRadioItem value="dark">Dark</ContextMenuRadioItem> <ContextMenuRadioItem value="system">System</ContextMenuRadioItem> </ContextMenuRadioGroup> ``` ### Example 2 ```tsx // With label and separator <ContextMenuContent> <ContextMenuLabel>Theme Selection</ContextMenuLabel> <ContextMenuSeparator /> <ContextMenuRadioGroup value={currentTheme} onValueChange={handleThemeChange}> <ContextMenuRadioItem value="light">Light Mode</ContextMenuRadioItem> <ContextMenuRadioItem value="dark">Dark Mode</ContextMenuRadioItem> <ContextMenuRadioItem value="auto">Auto</ContextMenuRadioItem> </ContextMenuRadioGroup> </ContextMenuContent> ```