See it in action
Click inside the area below, then move your pointer in any direction.
Move your pointer after opening to select
Dropdown with triangle navigation
Right-click below. Items with children open a submenu — the triangle prediction keeps it open while you move diagonally toward it.
Right-click to open the dropdown menu
Quick start
import { createPredictionConeMenu } from 'prediction-cone'; const menu = createPredictionConeMenu({ items: [ { id: 'home', label: '🏠 Home' }, { id: 'profile', label: '👤 Profile' }, { id: 'settings', label: '⚙️ Settings' }, { id: 'logout', label: '🚪 Logout' }, ], ringRadius: 120, itemSize: 60, coneHalfAngleDeg: 22.5, deadzone: 30, }); menu.attach(document); menu.on('select', (e) => { console.log('Selected:', e.item?.label); });
API
Attach to a DOM element. Opens on the configured trigger event.
Remove all event listeners previously added by .attach().
Open the menu programmatically at given viewport coordinates.
Dismiss the menu without firing a select event.
Replace the item list at runtime without re-creating the menu.
Subscribe to open, close, change, or select events.
Dropdown Menu
Create a list-based dropdown with triangle submenu navigation.
Add nested ConeItem[] to show a submenu with triangle-safe hover prediction.
CSS variables
Set any of these on an ancestor element to theme the menu.