ValyroUI Русская версия

Dropdown Menu

Dropdown menu. Free, MIT · Navigation and layout › Menus and commands

Installation

npx valyro-cli@latest add dropdown-menu
npx shadcn@latest add https://valyro.xyz/r/dropdown-menu.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { DropdownMenu } from 'valyro-ui';

Props

PropTypeDefault
triggerReactElementA single focusable element, usually a Button. Receives the menu-button ARIA and handlers. Or DropdownMenu.Trigger.
itemsMenuItem[]Menu rows: actions (with optional submenus), checkboxes, radio groups, separators and labels. Or compose them as children: DropdownMenu.Item, .CheckboxItem, .Label, .Separator.
childrenReactNodeThe compound form: a DropdownMenu.Trigger and the rows, instead of trigger and items.
openbooleanControlled open; use with onOpenChange.
defaultOpenbooleanfalseInitial open when uncontrolled.
onOpenChange(open: boolean) => voidCalled with the new open when it changes.
placementPlacement'bottom-start'Preferred side and alignment relative to the trigger; flips when there is no room.
animation'pop' | 'spring'pop (default): the theme's enter. spring: the menu and its submenus spring open and one highlight glides between rows.
classNamestringClass for the menu surface.

Compound parts

DropdownMenu.Trigger (DropdownMenuTrigger), DropdownMenu.Item (DropdownMenuItem), DropdownMenu.CheckboxItem (DropdownMenuCheckboxItem), DropdownMenu.Label (DropdownMenuLabel), DropdownMenu.Separator (DropdownMenuSeparator)

Related components

Previous: Stepper · Next: Context Menu · All Navigation and layout