Skip to content

Context menu

  • To display options for some context. Usually made visible on click (especially right click) and in conjunction with floating-ui.
<ContextMenu
id={menuID}
cx="max-w-[150px]"
>
<ContextMenuItem icon="refresh">Restart</ContextMenuItem>
<ContextMenuItem icon="open-in-new">View more info</ContextMenuItem>
<ContextMenuSeparator />
<ContextMenuItem
icon="trash-can-outline"
variant="danger"
>
Delete
</ContextMenuItem>
</ContextMenu>
<FloatingMenu
placement="bottom-start"
offset={4}
isOpen={floatingMenuOpen}
onChange={setFloatingMenuOpen}
>
<svelte:fragment slot="control">
<IconButton
icon="dots-horizontal"
label="See more"
/>
</svelte:fragment>
<svelte:fragment slot="items">
<ContextMenuItem icon="refresh">Restart</ContextMenuItem>
<ContextMenuItem icon="open-in-new">View more info</ContextMenuItem>
<ContextMenuSeparator />
<ContextMenuItem
icon="trash-can-outline"
variant="danger"
>
Delete
</ContextMenuItem>
</svelte:fragment>
</FloatingMenu>