React
LoadingLoading React…
No event yet
Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.
CompareMenus
The same example, live in each framework. One core underneath, so they should behave the same.
Loading React…
No event yet
Loading Vue…
No event yet
Loading Svelte…
No event yet
Loading Solid…
No event yet
Loading Angular…
No event yet
The attributes each framework puts on the open popup, read from the page.
| Attribute | React | Vue | Svelte | Solid | Angular |
|---|---|---|---|---|---|
role | Closed | Closed | Closed | Closed | Closed |
aria-modal | Closed | Closed | Closed | Closed | Closed |
aria-labelledby | Closed | Closed | Closed | Closed | Closed |
data-open | Closed | Closed | Closed | Closed | Closed |
Nothing open. Open a tile to fill its column.
Each tile above runs this file.
import { ContextMenu } from '@hamur/react/context-menu'
const areaStyle = {
padding: '32px 48px',
border: '1px dashed var(--demo-border)',
borderRadius: 12,
color: 'var(--demo-muted)',
fontSize: 14,
userSelect: 'none',
WebkitUserSelect: 'none',
} as const
export default function ContextMenuExample() {
return (
<ContextMenu.Root>
<ContextMenu.Trigger style={areaStyle}>
Right click here
</ContextMenu.Trigger>
<ContextMenu.Portal>
<ContextMenu.Positioner>
<ContextMenu.Popup className="menu">
<ContextMenu.Item className="menu-item">
Back
</ContextMenu.Item>
<ContextMenu.Item className="menu-item">
Forward
</ContextMenu.Item>
<ContextMenu.Item className="menu-item">
Reload
</ContextMenu.Item>
<ContextMenu.Item className="menu-item">
Save as...
</ContextMenu.Item>
</ContextMenu.Popup>
</ContextMenu.Positioner>
</ContextMenu.Portal>
</ContextMenu.Root>
)
}
The frameworks against each other only, on the same machine and the same example.
| Framework | Tests | Size | Open | Close | Memory |
|---|---|---|---|---|---|
| React | 79 | 71.6 KiB | 5.00 ms | 14.3 ms | 1.13 MiB |
| Vue | 81 | 71.8 KiB | 5.10 ms | 14.1 ms | 2.53 MiB |
| Svelte | 80 | 66.8 KiB | 7.00 ms | 12.1 ms | 2.45 MiB |
| Solid | 90 | 65.2 KiB | 4.70 ms | 14.4 ms | 1.66 MiB |
| Angular | 76 | 76.6 KiB | 5.80 ms | 12.4 ms | 0.89 MiB |
Size is the gzip of the component's entry with core and dom. Open, Close and Memory are medians in Chromium 156 on Apple M3 Max, 35 runs per framework; Memory is what one open and close leaves on the heap. Tests are Context Menu's passing tests in each framework's suites. [N] is a value not measured yet.
The ContextMenu.Root names in each framework's own syntax.
| Prop | React | Vue | Svelte | Solid | Angular |
|---|---|---|---|---|---|
| defaultOpen | defaultOpen | default-open | defaultOpen | defaultOpen | [defaultOpen] |
| open | open | open | open | open | [open] |
| onOpenChangeevent | onOpenChange | @open-change | onOpenChange | onOpenChange | (openChange) |
| highlightItemOnHover | highlightItemOnHover | highlight-item-on-hover | highlightItemOnHover | highlightItemOnHover | [highlightItemOnHover] |
| actionsRef | actionsRef | actions-ref | actionsRef | actionsRef | [actionsRef] |
| loopFocus | loopFocus | loop-focus | loopFocus | loopFocus | [loopFocus] |
| onItemHighlightedevent | onItemHighlighted | on-item-highlighted | onItemHighlighted | onItemHighlighted | (itemHighlighted) |
| onOpenChangeCompleteevent | onOpenChangeComplete | @open-change-complete | onOpenChangeComplete | onOpenChangeComplete | (openChangeComplete) |
| disabled | disabled | disabled | disabled | disabled | [disabled] |
| orientation | orientation | orientation | orientation | orientation | [orientation] |
| children | children | #default | children | children | ng-content |