UNPKG

@neynar/ui

Version:

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

92 lines (77 loc) 2.51 kB
# DropdownMenuRadioItem **Type**: component A radio button menu item for single selection within a group Must be used within a DropdownMenuRadioGroup. Shows a filled circle indicator when selected. Only one radio item can be selected per group, ensuring mutually exclusive selection behavior. ## JSX Usage ```jsx import { DropdownMenuRadioItem } from '@neynar/ui'; <DropdownMenuRadioItem value="value" disabled={true} onSelect={handleSelect} textValue="value" inset={true} className="value" > {/* Your content here */} </DropdownMenuRadioItem> ``` ## Component Props ### value - **Type**: `string` - **Required**: Yes - **Description**: The unique value this radio item represents ### disabled - **Type**: `boolean` - **Required**: No - **Description**: Whether the item is disabled and cannot be selected ### onSelect - **Type**: `(event: Event) => void` - **Required**: No - **Description**: Callback fired when the item is selected via click or keyboard ### textValue - **Type**: `string` - **Required**: No - **Description**: Optional text value used for typeahead search functionality ### inset - **Type**: `boolean` - **Required**: No - **Description**: Whether to add extra left padding to align with items that have icons ### className - **Type**: `string` - **Required**: No - **Description**: No description available ### children - **Type**: `React.ReactNode` - **Required**: No - **Description**: No description available ## Examples ### Example 1 ```tsx // Basic radio group for theme selection <DropdownMenuRadioGroup value={selectedTheme} onValueChange={setSelectedTheme}> <DropdownMenuRadioItem value="light"> <Sun className="mr-2 h-4 w-4" /> Light Theme </DropdownMenuRadioItem> <DropdownMenuRadioItem value="dark"> <Moon className="mr-2 h-4 w-4" /> Dark Theme </DropdownMenuRadioItem> <DropdownMenuRadioItem value="system"> <Monitor className="mr-2 h-4 w-4" /> System Theme </DropdownMenuRadioItem> </DropdownMenuRadioGroup> ``` ### Example 2 ```tsx // Priority selection with disabled option <DropdownMenuRadioGroup value={priority} onValueChange={setPriority}> <DropdownMenuRadioItem value="low">Low Priority</DropdownMenuRadioItem> <DropdownMenuRadioItem value="medium">Medium Priority</DropdownMenuRadioItem> <DropdownMenuRadioItem value="high">High Priority</DropdownMenuRadioItem> <DropdownMenuRadioItem value="urgent" disabled> Urgent (Premium Only) </DropdownMenuRadioItem> </DropdownMenuRadioGroup> ```