Context Menu
A menu that appears at the pointer on right click or long press.
Usage guidelines
- Use context menus as an enhancement: Don't make a context menu the only way to perform actions. People may not discover or be able to open one, especially on touch devices or with assistive technology. Always provide visible controls for the actions the context menu offers.
Anatomy
Import the primitives and assemble the parts:
@using Blazix.Primitives
<ContextMenuRoot>
<ContextMenuTrigger />
<ContextMenuPortal>
<ContextMenuBackdrop />
<ContextMenuPositioner>
<ContextMenuPopup>
<ContextMenuArrow />
<ContextMenuItem />
<ContextMenuLinkItem />
<ContextMenuSeparator />
<ContextMenuSubmenuRoot>
<ContextMenuSubmenuTrigger />
</ContextMenuSubmenuRoot>
<ContextMenuGroup>
<ContextMenuGroupLabel />
</ContextMenuGroup>
<ContextMenuRadioGroup>
<ContextMenuRadioItem>
<ContextMenuRadioItemIndicator />
</ContextMenuRadioItem>
</ContextMenuRadioGroup>
<ContextMenuCheckboxItem>
<ContextMenuCheckboxItemIndicator />
</ContextMenuCheckboxItem>
</ContextMenuPopup>
</ContextMenuPositioner>
</ContextMenuPortal>
</ContextMenuRoot>API Reference
ContextMenuRoot
Doesn't render its own HTML element.
ContextMenuTrigger
Renders a <div> element.
Other attributes are passed to the element it renders.
ContextMenuPortal
Doesn't render its own HTML element.
ContextMenuBackdrop
Renders a <div> element.
Other attributes are passed to the element it renders.
ContextMenuPositioner
Doesn't render its own HTML element.
ContextMenuPopup
Renders a <div> element.
Other attributes are passed to the element it renders.
ContextMenuArrow
Renders a <div> element.
Other attributes are passed to the element it renders.
ContextMenuItem
Renders a <div> element.
Other attributes are passed to the element it renders.
ContextMenuGroup
Renders a <div> element.
Other attributes are passed to the element it renders.
ContextMenuGroupLabel
Renders a <div> element.
Other attributes are passed to the element it renders.
ContextMenuSeparator
Renders a <div> element.
Other attributes are passed to the element it renders.
ContextMenuSubmenuRoot
Doesn't render its own HTML element.
ContextMenuSubmenuTrigger
Renders a <div> element.
Other attributes are passed to the element it renders.
ContextMenuRadioGroup
Renders a <div> element.
Other attributes are passed to the element it renders.
ContextMenuRadioItem
Renders a <div> element.
Other attributes are passed to the element it renders.
ContextMenuRadioItemIndicator
Renders a <span> element.
Other attributes are passed to the element it renders.
ContextMenuCheckboxItem
Renders a <div> element.
Other attributes are passed to the element it renders.
ContextMenuCheckboxItemIndicator
Renders a <span> element.
Other attributes are passed to the element it renders.
ContextMenuLinkItem
Renders a <a> element.
Other attributes are passed to the element it renders.