svelte-right-click

Github Octocat Logo npm logotype

Getting Started

To get started with svelte-right-click, first install the package in your project.

npm install --save-dev svelte-right-click
# pnpm add svelte-right-click
# yarn add svelte-right-click

Initialize the component, create a basic schema, and pass the schema to the contextMenuSchema store.

<script lang="ts">
	import ContextMenu, { contextMenuSchema } from 'svelte-right-click';
	import type { ContextMenuSchema } from 'svelte-right-click';

	const schema: ContextMenuSchema = {
		nodes: [
			{
				node_type: 'action',
				node_content: 'Fire an Alert!',
				callback: () => alert('Alert Fired from svelte-right-click!')
			}
		]
	};

	contextMenuSchema.set(schema);
</script>

<ContextMenu />