Skip to content
ray·elements
Get startedFoundationsComponentsExtendingChartsraylang

Buttons

Inputs

Navigation

Overlays

Data display

Feedback

Layout

Theme

Buttons

Button Button group Icon button Toggle Toggle group

Inputs

Avatar picker (Profile picture, Photo picker) Checkbox Checkbox group Color picker Combobox (Multi select) Date picker File upload Image crop Input Knob (Rotary, Dial, Potentiometer) Mode input Number input Password input Path input (File path, Folder picker) Radio group Search Segmented control Select Slider (Range, Fader) Switch Tags input (Tag input, Chips input, TagsInput) Textarea

Navigation

Bottom nav Breadcrumbs Document tabs Nav link Pagination Sidebar Stepper Tabs

Overlays

Command palette Dialog (Modal) Drawer Menu Popover Tooltip

Data display

Accordion Attachment Avatar Badge Blockquote Carousel Code Icon Indicator Kbd Meter (Level meter, VU meter, Peak meter) QR code (QR, Barcode, 2D code) Stat Table Timeline

Feedback

Alert Empty state Notification Progress Pulse Ring progress Skeleton Spinner Step dots

Layout

App bar App shell Aspect ratio Card Center Container Grid Group Scroll area Separator Split Stack Status bar

Theme

Theme toggle
Components/Overlays

Menu

A dropdown menu (menu button pattern: arrows, Home/End, typeahead, Enter, Escape) or, with context, a context menu at the pointer.

Source on GitHub

Row actions
  • release-notes.md12 KB · 2 h ago
  • screenshot-dark.png1.8 MB · yesterday
  • bundles6 files · Oct 2
Use the ⋯ of a row.
Account and view options
ada@ray.dev Profile Settings⌘, Notifications3 Workspace Switch workspace Invite people Sign out View Show (keep-open) Line numbers Minimap Word wrap Whitespace Density Compact Comfortable Showing: lines, wrap · comfortable
Placements
bottom-startOneTwo bottomOneTwo bottom-endOneTwo top-startOneTwo right-startOneTwo left-startOneTwo
Context menu
Right-click (or long-press) anywhere on the canvas
Cut⌘X Copy⌘C Paste⌘V Bring to front Send to back
Code

Open the code

In a raylang app

With native and the native bridge, the menu opens as the system's context menu at the pointer: its items and dividers, disabled ones greyed out. The choice fires the same ray-select, so the same code handles both.

<ray-menu native context>
  <div slot="trigger" class="file-row">report.csv</div>
  <ray-menu-item value="open">Open</ray-menu-item>
  <ray-menu-item value="reveal">Show in Finder</ray-menu-item>
  <ray-menu-divider></ray-menu-divider>
  <ray-menu-item value="delete" color="red">Delete</ray-menu-item>
</ray-menu>

Checkbox and radio items show their check mark there too. Labels, nested menus, icons and colors are the page menu's only. A dismissed native menu fires nothing.

The native menu reads its items the moment it opens, so items that depend on what was clicked go in ray-request-open, which comes first (a contextmenu listener of your own on the trigger may run after the menu's):

menu.addEventListener("ray-request-open", (e) => {
  const row = e.detail.event.target.closest(".file-row");
  menu.replaceChildren(menu.querySelector("[slot=trigger]"), ...itemsFor(row));
});

API

For AI agents: this API as Markdown, or every component in llms-full.txt.

<ray-menu>

PropertyAttributeTypeDefaultDescription
openopen reflectsbooleanShown.
placementplacement reflectsbottom-start | bottom | bottom-end | top-start | top | top-end | right-start | left-startbottom-startPreferred side and alignment: top/bottom/left/right are sides of the screen; on top and bottom, -start/-end follow the writing direction (right to left, "bottom-start" lines up the right edges).
contextcontext reflectsbooleanOpens on right click (contextmenu) over the trigger area, at the pointer.
keepOpenkeep-open reflectsbooleanChoosing an item does not close the menu.
nativenative reflectsbooleanWith a native host (ray-elements/core/raylang.js in a std/ui window), opens as the system's context menu at the pointer: items and dividers, same ray-select. Where the system has none (a phone: the bridge does not offer it) or the call fails, the page's menu opens.
anchor—objectWhat the panel is placed against instead of the trigger: an element, a DOMRect or a function returning one (a text range, the pointer; read again on every reposition). The trigger still opens it.
EventDescription
ray-selectAn item was chosen; detail: { value, item }.
ray-request-openIts trigger is about to open it (click, Arrow keys, right click), before the items are read, native menu included: fill items that depend on what was clicked here. Cancelable (preventDefault keeps it closed). Not fired by show() or open = true. detail: { event }.
ray-openAfter it opened.
ray-closeAfter it closed.
SlotDescription
triggerThe button that opens it, or the area for a context menu (a press on the area outside the open menu closes it; a right click reopens it at the new point).
(default)ray-menu-item, ray-menu-label and ray-menu-divider elements.
PartDescription
dropdownThe panel.

<ray-menu-item>

PropertyAttributeTypeDefaultDescription
valuevalue reflectsstringReported in ray-select (default: the text).
disableddisabled reflectsbooleanSkipped by the keyboard, cannot be chosen.
colorcolor reflectsstringText and hover color (e.g. red for destructive actions).
typetype reflectsitem | checkbox | radioitemcheckbox: choosing it toggles checked (menuitemcheckbox); radio: choosing it checks it and unchecks the radio items of the menu with the same name (menuitemradio). Both show a check mark when checked, in the native menu too.
checkedchecked reflectsbooleanChecked (checkbox and radio items). Already updated when ray-select fires.
namename reflectsstringThe group of a radio item: one checked per name in the menu.
SlotDescription
(default)Label.
leftIcon.
rightShortcut or badge.
PartDescription
markThe check mark of a checkbox or radio item.

<ray-menu-label>

A section caption inside the menu.

<ray-menu-divider>

A separator between groups of items.

PreviousDrawerNextPopover
ray·elements — web components for any app, with raylang extras GitHub · npm · Changelog · License For AI agents: llms.txt · llms-full.txt Tokens, docs, tests and wrappers generated by tools/run.sh build