mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
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:
parent
d8f8ac2b73
commit
ccc733f3f7
8 changed files with 261 additions and 52 deletions
|
@ -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" />
|
Loading…
Add table
Add a link
Reference in a new issue