Context Menu
Setup
Jhana UI uses a singleton Svelte component. You have to include this once in your root layout. Then you can use the context menu system across your whole app.
Global Menu
I like to have a single file that contains all context menus used by the app. However you can also write them specifically in those Svelte components or pages, where you actually need them.
Tag Map
You can also set up global behavior for specific element tags.
Binding to Elements
You've seen how you can set a global context menu, but of course you can bind one to any element.
Custom Content
Beyond basic text, you can also provide a custom RenderingContent<CtxMenuItemProps>. This means { snippet: Snippet<[CtxMenuItemProps]> } | { component: Component<CtxMenuItemProps> }. Of
course, you can put any content inside, but this is how to do it, if you want it to look like the native context
menu. Your RenderingContent can contain multiple context menu entries. You wrap each one in a <li> and put a <button> inside – or multiple, if you want a horizontal button group. As long as you
wrap with <li>, everything is auto-styled for you. No need for any classes.