mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
docs(context-menu): improve docs
This commit is contained in:
parent
073091f4f6
commit
5ec91a552e
1 changed files with 10 additions and 4 deletions
|
@ -6,26 +6,32 @@ components: ["ContextMenu", "ContextMenuGroup", "ContextMenuRadioGroup", "Contex
|
|||
import Preview from "../../components/Preview.svelte";
|
||||
</script>
|
||||
|
||||
`ContextMenu` displays a menu when users right-click. Use it to provide quick access to contextual actions or options.
|
||||
|
||||
In the examples, right click anywhere within the iframe.
|
||||
|
||||
## Default
|
||||
|
||||
By default, the context menu will trigger when right clicking anywhere in the `window`.
|
||||
The context menu appears when right-clicking anywhere in the window. Use `ContextMenuOption` for menu items and `ContextMenuDivider` for visual separation.
|
||||
|
||||
<FileSource src="/framed/ContextMenu/ContextMenu" />
|
||||
|
||||
## Custom target
|
||||
|
||||
Specify a custom `HTMLElement` using the `target` prop.
|
||||
By default, the context menu will trigger when right clicking anywhere in the `window`.
|
||||
|
||||
Set `target` to specify which element triggers the context menu.
|
||||
|
||||
<FileSource src="/framed/ContextMenu/ContextMenuTarget" />
|
||||
|
||||
## Multiple targets
|
||||
|
||||
The `target` prop also accepts an array of elements.
|
||||
Set `target` to an array of elements to trigger the context menu from multiple sources.
|
||||
|
||||
<FileSource src="/framed/ContextMenu/ContextMenuTargets" />
|
||||
|
||||
## Radio groups
|
||||
|
||||
|
||||
Use `ContextMenuGroup` and `ContextMenuRadioGroup` to organize related options and create radio button selections.
|
||||
|
||||
<FileSource src="/framed/ContextMenu/ContextMenuGroups" />
|
Loading…
Add table
Add a link
Reference in a new issue