UNPKG

@neynar/ui

Version:

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

53 lines (42 loc) 1.33 kB
# MenubarSub **Type**: component Container for a submenu. Wraps MenubarSubTrigger and MenubarSubContent to create nested menu structures. Supports controlled and uncontrolled states. ## JSX Usage ```jsx import { MenubarSub } from '@neynar/ui'; <MenubarSub open={true} defaultOpen={true} onOpenChange={handleOpenChange} /> ``` ## Component Props ### open - **Type**: `boolean` - **Required**: No - **Description**: The controlled open state of the sub menu. Must be used in conjunction with onOpenChange ### defaultOpen - **Type**: `boolean` - **Required**: No - **Description**: The open state of the submenu when it is initially rendered. Use when you do not need to control its open state ### onOpenChange - **Type**: `(open: boolean) => void` - **Required**: No - **Description**: Event handler called when the open state of the submenu changes ## Examples ```tsx <MenubarSub> <MenubarSubTrigger>Export</MenubarSubTrigger> <MenubarSubContent> <MenubarItem>Export as PDF</MenubarItem> <MenubarItem>Export as CSV</MenubarItem> <MenubarItem>Export as JSON</MenubarItem> </MenubarSubContent> </MenubarSub> // Controlled submenu <MenubarSub open={exportOpen} onOpenChange={setExportOpen}> <MenubarSubTrigger>Export</MenubarSubTrigger> <MenubarSubContent>...</MenubarSubContent> </MenubarSub> ``` /