Skip to content

prosekit/web/menu

<prosekit-menu-root>
  <prosekit-menu-trigger>...</prosekit-menu-trigger>
  <prosekit-menu-positioner>
    <prosekit-menu-popup>
       <prosekit-menu-item>...</prosekit-menu-item>
       <prosekit-menu-submenu-root>
         <prosekit-menu-submenu-trigger>...</prosekit-menu-submenu-trigger>
         <prosekit-menu-positioner>
           <prosekit-menu-popup>
             <prosekit-menu-item>...</prosekit-menu-item>
           </prosekit-menu-popup>
         </prosekit-menu-positioner>
       </prosekit-menu-submenu-root>
    </prosekit-menu-popup>
  </prosekit-menu-positioner>
</prosekit-menu-root>

<prosekit-menu-item> custom element.

Properties: MenuItemProps

Events: MenuItemEvents

Data attributes:

AttributeDescription
data-highlightedPresent when the item is the currently highlighted option

new MenuItemElement(): MenuItemElement

value: string

The unique value for this menu item.

""

disabled: boolean

Whether this menu item is disabled.

false

closeOnSelect: boolean

Whether to close the menu when the item is pressed.

true

addController(controller: ReactiveController): void

removeController(controller: ReactiveController): void

connectedCallback(): void

disconnectedCallback(): void


<prosekit-menu-popup> custom element.

Properties: MenuPopupProps

Data attributes:

AttributeDescription
data-state"open" when the menu is visible, "closed" otherwise

new MenuPopupElement(): MenuPopupElement

eventTarget: EventTarget | HTMLElement | null

By default, the MenuPopup element will listen for keydown events. You can pass a different element to listen for keydown events.

null

addController(controller: ReactiveController): void

removeController(controller: ReactiveController): void

connectedCallback(): void

disconnectedCallback(): void


<prosekit-menu-positioner> custom element.

Properties: MenuPositionerProps

Data attributes:

AttributeDescription
data-state"open" when the menu is visible, "closed" otherwise

CSS variables:

VariableDescription
--transform-originThe coordinates that this element is anchored to. Useful for scale animations.

new MenuPositionerElement(): MenuPositionerElement

placement: Placement

The initial placement of the floating element

"bottom-start"

strategy: "fixed" | "absolute"

The strategy to use for positioning

"absolute"

autoUpdate: boolean | AutoUpdateOptions

Options to activate auto-update listeners

https://floating-ui.com/docs/autoUpdate

true

hoist: boolean

Whether to use the browser Popover API to place the floating element on top of other page content.

true

offset: OffsetOptions

The distance between the reference and floating element.

6

flip: boolean | Placement[]

Whether to flip the placement in order to keep it in view when the preferred placement(s) will overflow the clipping boundary. You can also provide an array of placements to try sequentially if the preferred placement does not fit.

true

shift: boolean

Whether the floating element should shift to keep it in view.

true

overlap: boolean

Whether the floating element can overlap the reference element to keep it in view.

false

fitViewport: boolean

Whether to constrain the floating element's width and height to not exceed the viewport.

false

sameWidth: boolean

Whether to constrain the floating element's width so that it matches the reference element.

false

sameHeight: boolean

Whether to constrain the floating element's height so that it matches the reference element.

false

inline: boolean

Whether to improve positioning for inline reference elements that span over multiple lines.

false

hide: boolean

Whether to hide the floating element when the reference element or the floating element is fully clipped.

false

boundary: Boundary

Describes the clipping element(s) or area that overflow will be checked relative to. Please see https://floating-ui.com/docs/detectoverflow#boundary for more information.

'clippingAncestors'

rootBoundary: RootBoundary

Describes the root boundary that the element will be checked for overflow relative to. Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information.

'viewport'

overflowPadding: number

Describes the virtual padding around the boundary to check for overflow. Please see https://floating-ui.com/docs/detectoverflow#padding for more information.

4

elementContext: ElementContext

The element that will be used to check for overflow. Please see https://floating-ui.com/docs/detectoverflow#elementcontext for more information.

'floating'

altBoundary: boolean

Whether to check the alternate elementContext's boundary. Please see https://floating-ui.com/docs/detectoverflow#altboundary for more information.

false

addController(controller: ReactiveController): void

removeController(controller: ReactiveController): void

connectedCallback(): void

disconnectedCallback(): void


<prosekit-menu-root> custom element.

Properties: MenuRootProps

Events: MenuRootEvents

Data attributes:

AttributeDescription
data-menu-rootAlways present on the element

new MenuRootElement(): MenuRootElement

defaultOpen: boolean

Whether the overlay is initially open.

false

open: boolean | null

Whether the overlay is currently open.

null

disabled: boolean

Whether the component should ignore user interaction.

false

addController(controller: ReactiveController): void

removeController(controller: ReactiveController): void

connectedCallback(): void

disconnectedCallback(): void


<prosekit-menu-submenu-root> custom element.

Properties: MenuSubmenuRootProps

Events: MenuSubmenuRootEvents

Data attributes:

AttributeDescription
data-menu-submenu-rootAlways present on the element

new MenuSubmenuRootElement(): MenuSubmenuRootElement

defaultOpen: boolean

Whether the overlay is initially open.

false

open: boolean | null

Whether the overlay is currently open.

null

disabled: boolean

Whether the component should ignore user interaction.

false

addController(controller: ReactiveController): void

removeController(controller: ReactiveController): void

connectedCallback(): void

disconnectedCallback(): void


<prosekit-menu-submenu-trigger> custom element.

Properties: MenuSubmenuTriggerProps

Data attributes:

AttributeDescription
data-highlightedPresent when the item is the currently highlighted option

new MenuSubmenuTriggerElement(): MenuSubmenuTriggerElement

value: string

The unique value for this submenu trigger in the parent menu.

""

disabled: boolean

Whether this submenu trigger is disabled.

false

addController(controller: ReactiveController): void

removeController(controller: ReactiveController): void

connectedCallback(): void

disconnectedCallback(): void


<prosekit-menu-trigger> custom element.

Properties: MenuTriggerProps

Events: MenuTriggerEvents

new MenuTriggerElement(): MenuTriggerElement

disabled: boolean

Whether the component should ignore user interaction.

false

addController(controller: ReactiveController): void

removeController(controller: ReactiveController): void

connectedCallback(): void

disconnectedCallback(): void

value: string

The unique value for this menu item.

""

disabled: boolean

Whether this menu item is disabled.

false

closeOnSelect: boolean

Whether to close the menu when the item is pressed.

true


eventTarget: EventTarget | HTMLElement | null

By default, the MenuPopup element will listen for keydown events. You can pass a different element to listen for keydown events.

null


placement: Placement

The initial placement of the floating element

"bottom-start"

strategy: "fixed" | "absolute"

The strategy to use for positioning

"absolute"

autoUpdate: boolean | AutoUpdateOptions

Options to activate auto-update listeners

https://floating-ui.com/docs/autoUpdate

true

hoist: boolean

Whether to use the browser Popover API to place the floating element on top of other page content.

true

offset: OffsetOptions

The distance between the reference and floating element.

6

flip: boolean | Placement[]

Whether to flip the placement in order to keep it in view when the preferred placement(s) will overflow the clipping boundary. You can also provide an array of placements to try sequentially if the preferred placement does not fit.

true

shift: boolean

Whether the floating element should shift to keep it in view.

true

overlap: boolean

Whether the floating element can overlap the reference element to keep it in view.

false

fitViewport: boolean

Whether to constrain the floating element's width and height to not exceed the viewport.

false

sameWidth: boolean

Whether to constrain the floating element's width so that it matches the reference element.

false

sameHeight: boolean

Whether to constrain the floating element's height so that it matches the reference element.

false

inline: boolean

Whether to improve positioning for inline reference elements that span over multiple lines.

false

hide: boolean

Whether to hide the floating element when the reference element or the floating element is fully clipped.

false

boundary: Boundary

Describes the clipping element(s) or area that overflow will be checked relative to. Please see https://floating-ui.com/docs/detectoverflow#boundary for more information.

'clippingAncestors'

rootBoundary: RootBoundary

Describes the root boundary that the element will be checked for overflow relative to. Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information.

'viewport'

overflowPadding: number

Describes the virtual padding around the boundary to check for overflow. Please see https://floating-ui.com/docs/detectoverflow#padding for more information.

4

elementContext: ElementContext

The element that will be used to check for overflow. Please see https://floating-ui.com/docs/detectoverflow#elementcontext for more information.

'floating'

altBoundary: boolean

Whether to check the alternate elementContext's boundary. Please see https://floating-ui.com/docs/detectoverflow#altboundary for more information.

false


defaultOpen: boolean

Whether the overlay is initially open.

false

open: boolean | null

Whether the overlay is currently open.

null

disabled: boolean

Whether the component should ignore user interaction.

false


defaultOpen: boolean

Whether the overlay is initially open.

false

open: boolean | null

Whether the overlay is currently open.

null

disabled: boolean

Whether the component should ignore user interaction.

false


value: string

The unique value for this submenu trigger in the parent menu.

""

disabled: boolean

Whether this submenu trigger is disabled.

false


disabled: boolean

Whether the component should ignore user interaction.

false


select: SelectEvent

Emitted when the the item is selected.


openChange: OpenChangeEvent

Emitted when the menu is opened or closed.


openChange: OpenChangeEvent

Emitted when the submenu is opened or closed.


openChange: OpenChangeEvent

Emitted when the menu is opened or closed.

function registerMenuRootElement(): void


function registerMenuTriggerElement(): void


function registerMenuPositionerElement(): void


function registerMenuPopupElement(): void


function registerMenuItemElement(): void


function registerMenuSubmenuRootElement(): void


function registerMenuSubmenuTriggerElement(): void

Re-exports OpenChangeEvent


Re-exports SelectEvent