API reference
@salmonui/buttons/menu
52 exported symbols: 14 functions, 25 interfaces, 11 types and 2 constants. Each name links its page with the signature, docs and members.
import { … } from '@salmonui/buttons/menu';Functions
ContextMenuOpens a menu at the pointer for its target. <ContextMenu menu={<Menu>...</Menu>}>{target}</ContextMenu>, or targetRef for an element it does not wrap.MenuA menu list rendered in place (role="menu", one tab stop with roving focus). MenuButton and SplitButton render the same list in a popup.MenuButtonAPG Menu Button: a Button that opens a menu (aria-haspopup="menu", aria-expanded, aria-controls while open). Enter, Space and ArrowDown open it on the first it…MenuCheckboxItemrole="menuitemcheckbox" with the checked triad.MenuGrouprole="group" of items with an optional visible label.MenuItemMenuRadioGrouprole="group" of MenuRadioItems with the value triad.MenuRadioItemrole="menuitemradio" inside a MenuRadioGroup.MenuSeparatorrole="separator"; never focusable.MenubarAPG Menubar: role="menubar", horizontal, one tab stop.MenubarItemA top-level command or link without a menu.MenubarMenuA top-level item that opens a menu (aria-haspopup="menu", aria-expanded).SplitButtonA primary Button and a menu trigger joined in one group: two tab stops; the trigger follows the Menu Button keys and Alt+ArrowDown on the primary part opens th…
Interfaces
ContextMenuBeforeCloseEventonBeforeClose event; preventDefault() keeps the menu open.ContextMenuBeforeOpenEventonBeforeOpen event; preventDefault() keeps the menu closed (and the browser menu shows).ContextMenuLocaleTextContextMenuPointViewport coordinates in CSS px (clientX / clientY).ContextMenuPropsMenuActionEventonAction event: a chosen item. preventDefault() keeps the menu open (and stops link navigation).MenuButtonMenuPropsMenuChangeEventSecond argument of onCheckedChange / onValueChange in menus (frozen).MenuCheckboxItemPropsMenuGroupPropsMenuItemDataData form of a menu entry (items prop). type defaults to 'item'; an item with items is a submenu; 'group' is a labelled group of items.MenuItemPropsMenuOpenChangeEventSecond argument of onOpenChange (frozen).MenuPropsMenuRadioGroupPropsMenuRadioItemPropsMenuSeparatorPropsMenubarBeforeValueChangeEventonBeforeValueChange; preventDefault() keeps the current menu (or none) open.MenubarItemPropsMenubarLocaleTextMenubarMenuPropsMenubarPropsMenubarValueChangeEventSecond argument of onValueChange (frozen in development).SplitButtonProps
Types
ContextMenuPartPopup parts that accept classNames / styles.ContextMenuSourceInput that asked for the menu.MenuButtonPartPopup parts that accept classNames / styles.MenuButtonPropsAn iconOnly trigger needs aria-label or aria-labelledby.MenuItemRenderPropsProps passed to a custom item element (render): spread them all.MenuOpenChangeReasonWhy a menu opened or closed.MenuPlacementPopup side relative to the trigger; start / end are logical (mirrored under dir="rtl").MenuSourceInput that caused a change or an action.MenubarValueChangeReasonWhy the open top-level menu changed; 'navigate' is an arrow key or the pointer moving across the bar.SplitButtonPartParts that accept classNames / styles.