Base UITransitions
Context menu
Shares its parts with Menu, and therefore its rule.
Every value the manifest allows on this host, single presets and the pairs that compose. The first is what this component ships with. Both stages are the same component, so anything that changes between them is the attribute.
withoutno attribute
right click here
with easefuldata-motion="scale-fade"
right click here
host writes
data-ending-style
easeful matches
[data-motion~="scale-fade"][data-ending-style]
what runs
transition: opacity, scale 150ms
you write
<ContextMenu.Popup data-motion="scale-fade" />
Where the attribute goes
The parts this demo composes, and the value each one carries. Everything inside an animated part is that part's content, so the tree stops there.
ContextMenu.RootContextMenu.TriggerContextMenu.PortalContextMenu.PositionerContextMenu.Popupdata-motion="scale-fade"
Source
"use client"
import { ContextMenu } from "@base-ui/react/context-menu"
import type { DemoProps } from "@/components/demos/props"
export function BaseUiContextMenu({ motion }: DemoProps) {
return (
<ContextMenu.Root>
<ContextMenu.Trigger className="dropzone">right click here</ContextMenu.Trigger>
<ContextMenu.Portal>
<ContextMenu.Positioner collisionPadding={16}>
<ContextMenu.Popup className="menu" data-motion={motion}>
<ContextMenu.Item className="menu__item">Rename</ContextMenu.Item>
<ContextMenu.Item className="menu__item">Duplicate</ContextMenu.Item>
<ContextMenu.Item className="menu__item">Archive</ContextMenu.Item>
</ContextMenu.Popup>
</ContextMenu.Positioner>
</ContextMenu.Portal>
</ContextMenu.Root>
)
}motion prop is the only difference between them.