diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md
index 6e435199..04383f3c 100644
--- a/COMPONENT_INDEX.md
+++ b/COMPONENT_INDEX.md
@@ -780,12 +780,13 @@ None.
### Props
-| Prop name | Kind | Reactive | Type | Default value | Description |
-| :-------- | :--------------- | :------- | :---------------------------------------- | ------------------ | -------------------------------------------------------------------------------- |
-| ref | let
| Yes | null | HTMLUListElement
| null
| Obtain a reference to the unordered list HTML element |
-| y | let
| Yes | number
| 0
| Specify the vertical offset of the menu position |
-| x | let
| Yes | number
| 0
| Specify the horizontal offset of the menu position |
-| open | let
| Yes | boolean
| false
| Set to `true` to open the menu
Either `x` and `y` must be greater than zero |
+| Prop name | Kind | Reactive | Type | Default value | Description |
+| :-------- | :--------------- | :------- | :-------------------------------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
+| ref | let
| Yes | null | HTMLUListElement
| null
| Obtain a reference to the unordered list HTML element |
+| y | let
| Yes | number
| 0
| Specify the vertical offset of the menu position |
+| x | let
| Yes | number
| 0
| Specify the horizontal offset of the menu position |
+| open | let
| Yes | boolean
| false
| Set to `true` to open the menu
Either `x` and `y` must be greater than zero |
+| target | let
| No | null | HTMLElement | HTMLElement[]
| null
| Specify an element or list of elements to trigger the context menu.
If no element is specified, the context menu applies to the entire window |
### Slots
@@ -795,12 +796,12 @@ None.
### Events
-| Event name | Type | Detail |
-| :--------- | :--------- | :----- |
-| click | forwarded | -- |
-| keydown | forwarded | -- |
-| open | dispatched | -- |
-| close | dispatched | -- |
+| Event name | Type | Detail |
+| :--------- | :--------- | :----------------------- |
+| open | dispatched | HTMLElement
|
+| click | forwarded | -- |
+| keydown | forwarded | -- |
+| close | dispatched | -- |
## `ContextMenuDivider`
diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json
index 41a03e33..7bc1b87a 100644
--- a/docs/src/COMPONENT_API.json
+++ b/docs/src/COMPONENT_API.json
@@ -1809,6 +1809,17 @@
"moduleName": "ContextMenu",
"filePath": "src/ContextMenu/ContextMenu.svelte",
"props": [
+ {
+ "name": "target",
+ "kind": "let",
+ "description": "Specify an element or list of elements to trigger the context menu.\nIf no element is specified, the context menu applies to the entire window",
+ "type": "null | HTMLElement | HTMLElement[]",
+ "value": "null",
+ "isFunction": false,
+ "isFunctionDeclaration": false,
+ "constant": false,
+ "reactive": false
+ },
{
"name": "open",
"kind": "let",
@@ -1856,9 +1867,9 @@
],
"slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }],
"events": [
+ { "type": "dispatched", "name": "open", "detail": "HTMLElement" },
{ "type": "forwarded", "name": "click", "element": "ul" },
{ "type": "forwarded", "name": "keydown", "element": "ul" },
- { "type": "dispatched", "name": "open" },
{ "type": "dispatched", "name": "close" }
],
"typedefs": [],
diff --git a/docs/src/pages/components/ContextMenu.svx b/docs/src/pages/components/ContextMenu.svx
index d195fd63..a37e7a32 100644
--- a/docs/src/pages/components/ContextMenu.svx
+++ b/docs/src/pages/components/ContextMenu.svx
@@ -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`.
Right click this element
+Right click this element
+... or this one
+