{"id":23086981,"url":"https://github.com/chaseottofy/tiny-context-menu-js","last_synced_at":"2025-07-26T22:33:56.130Z","repository":{"id":182543331,"uuid":"668674836","full_name":"chaseottofy/tiny-context-menu-js","owner":"chaseottofy","description":"2KB context menu library w/ easy customizability ","archived":false,"fork":false,"pushed_at":"2023-07-23T14:43:15.000Z","size":1078,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T23:42:17.178Z","etag":null,"topics":["context-menu","library","typescript","ui-library","vanilla-component","vanilla-components","vanilla-js"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/tiny-context-menu-js","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chaseottofy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-20T10:51:08.000Z","updated_at":"2023-07-21T04:07:35.000Z","dependencies_parsed_at":"2024-10-03T15:53:00.691Z","dependency_job_id":"20c76dd6-1041-4a99-a8c0-a3b6114edb00","html_url":"https://github.com/chaseottofy/tiny-context-menu-js","commit_stats":null,"previous_names":["chaseottofy/context-menu","chaseottofy/tiny-context-menu-js"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaseottofy%2Ftiny-context-menu-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaseottofy%2Ftiny-context-menu-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaseottofy%2Ftiny-context-menu-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chaseottofy%2Ftiny-context-menu-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chaseottofy","download_url":"https://codeload.github.com/chaseottofy/tiny-context-menu-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246802622,"owners_count":20836372,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["context-menu","library","typescript","ui-library","vanilla-component","vanilla-components","vanilla-js"],"created_at":"2024-12-16T19:40:03.924Z","updated_at":"2025-04-03T16:28:03.235Z","avatar_url":"https://github.com/chaseottofy.png","language":"TypeScript","readme":"## tiny-context-menu-js\n\n* Gzips 2KB\n* Zero dependencies\n* Light/Dark themes + easy customization\n* Type support\n* Edge detection, Dynamic Positioning\n* Accounts for any page scroll\n* Memory and Event Clean-up\n* [DEMO (codepen)](https://codepen.io/chaseottofy/pen/vYQaaeq)\n\n![screen](screenshots/scrdark.png)\n*Dark mode*\n\n### Installation\n\n```bash\nnpm i tiny-context-menu-js\n```\n\n### Vanilla js\n```javascript\nimport ContextMenu from \"tiny-context-menu-js\";\nconst targetContainer = document.querySelector('.target-container')\nconst options = [\n  { label: 'Item 1', action: () =\u003e { console.log('item 1'); } },\n  { label: 'Item 2', action: () =\u003e { console.log('item 2'); } },\n]\n\nContextMenu(targetContainer, options, 'light').init(); // initialize instance\nContextMenu().destroy();                               // remove instance\n```\n\n### TypeScript\n```javascript\nimport ContextMenu, { MenuOption } from \"tiny-context-menu-js\";\nconst targetContainer = document.querySelector('.target-container') as HTMLElement;\nconst options: MenuOption[] = [\n  { label: 'Item 1', action: () =\u003e { console.log('item 1'); } },\n  { label: 'Item 2', action: () =\u003e { console.log('item 2'); } },\n]\n\nContextMenu(targetContainer, options).init(); // initialize instance (forego theme param for default 'dark')\nContextMenu().destroy();                      // remove instance\n```\n\n### Options examples\n\n```javascript\n\n// Use svgs within labels:\n// Must wrap label value in Array. \n// Svg must be defined in first index of Array --\u003e [svg, 'title']\nconst svg = '\u003csvg stroke=\"currentColor\" fill=\"currentColor\" stroke-width=\"0\" viewBox=\"0 0 20 20\" aria-hidden=\"true\" height=\"14px\" width=\"14px\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cpath fill-rule=\"evenodd\" d=\"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z\" clip-rule=\"evenodd\"\u003e\u003c/path\u003e\u003c/svg\u003e';\n\nconst items = [\n  {\n    label: [svg, \"Item Title\"],\n  }\n]\n```\n\n### Theme examples\n```javascript\n// Two pre-loaded themes (dark/light)\nconst theme = 'dark'\nconst theme2 = 'light'\n\n// Custom Theming - KEYS ARE CASE SENSITIVE\nconst theme3 = { \n  background: 'red',\n  backgroundhover: 'rgba(0, 255, 0, 0.8)',\n  text: '#eee',\n  texthover: '#FFFFFF',\n  scrollthumb: 'hsla(0, 0%, 20%, 0.8 )',\n}\n```\n\n![screen](screenshots/scrlight.png)\n*Light mode*\n\n### Altering CSS\n\n**CSS comes preloaded**\n- If you want to edit the CSS directly, do so in \n`\"../node_modules/tiny-context-menu-js/dist/context-menu.css\"`\n\n### License\n\nThis project is licensed under the [MIT License](https://github.com/chaseottofy/tiny-context-menu-js/blob/main/LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchaseottofy%2Ftiny-context-menu-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchaseottofy%2Ftiny-context-menu-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchaseottofy%2Ftiny-context-menu-js/lists"}