Support custom target(s) for ContextMenu (#916)

* feat(context-menu): add target prop to selectively trigger context menu

* feat(context-menu): include clicked element in "open" event detail

* docs(context-menu): add target, multiple target examples
This commit is contained in:
Eric Liu 2021-11-18 13:32:13 -08:00 committed by GitHub
commit ccc733f3f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 261 additions and 52 deletions

View file

@ -9,9 +9,23 @@ components: ["ContextMenu", "ContextMenuGroup", "ContextMenuRadioGroup", "Contex
In the examples, right click anywhere within the iframe.
### Default
By default, the context menu will trigger when right clicking anywhere in the `window`.
<FileSource src="/framed/ContextMenu/ContextMenu" />
### Custom target
Specify a custom `HTMLElement` using the `target` prop.
<FileSource src="/framed/ContextMenu/ContextMenuTarget" />
### Multiple targets
The `target` prop also accepts an array of elements.
<FileSource src="/framed/ContextMenu/ContextMenuTargets" />
### Radio groups
<FileSource src="/framed/ContextMenu/ContextMenuGroups" />