prosekit/web/menu
Anatomy
Section titled “Anatomy”Classes
Section titled “Classes”MenuItemElement
Section titled “MenuItemElement”<prosekit-menu-item> custom element.
Properties: MenuItemProps
Events: MenuItemEvents
Data attributes:
| Attribute | Description |
|---|---|
data-highlighted | Present when the item is the currently highlighted option |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”-
new MenuItemElement():MenuItemElement
Properties
Section titled “Properties”-
value:string -
The unique value for this menu item.
Default
Section titled “Default”""
-
disabled:boolean -
Whether this menu item is disabled.
Default
Section titled “Default”false
-
closeOnSelect:boolean -
Whether to close the menu when the item is pressed.
Default
Section titled “Default”true
Methods
Section titled “Methods”-
addController(controller:ReactiveController):void
-
removeController(controller:ReactiveController):void
-
connectedCallback():void
-
disconnectedCallback():void
MenuPopupElement
Section titled “MenuPopupElement”<prosekit-menu-popup> custom element.
Properties: MenuPopupProps
Data attributes:
| Attribute | Description |
|---|---|
data-state | "open" when the menu is visible, "closed" otherwise |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”-
new MenuPopupElement():MenuPopupElement
Properties
Section titled “Properties”-
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.
Default
Section titled “Default”null
Methods
Section titled “Methods”-
addController(controller:ReactiveController):void
-
removeController(controller:ReactiveController):void
-
connectedCallback():void
-
disconnectedCallback():void
MenuPositionerElement
Section titled “MenuPositionerElement”<prosekit-menu-positioner> custom element.
Properties: MenuPositionerProps
Data attributes:
| Attribute | Description |
|---|---|
data-state | "open" when the menu is visible, "closed" otherwise |
CSS variables:
| Variable | Description |
|---|---|
--transform-origin | The coordinates that this element is anchored to. Useful for scale animations. |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”Properties
Section titled “Properties”-
placement:Placement -
The initial placement of the floating element
Default
Section titled “Default”"bottom-start"
-
strategy:"fixed"|"absolute" -
The strategy to use for positioning
Default
Section titled “Default”"absolute"
-
autoUpdate:boolean|AutoUpdateOptions -
Options to activate auto-update listeners
https://floating-ui.com/docs/autoUpdate
Default
Section titled “Default”true
-
hoist:boolean -
Whether to use the browser Popover API to place the floating element on top of other page content.
Default
Section titled “Default”true
-
offset:OffsetOptions -
The distance between the reference and floating element.
Default
Section titled “Default”6
-
flip:boolean|Placement[] -
Whether to flip the
placementin 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 preferredplacementdoes not fit.Default
Section titled “Default”true
-
shift:boolean -
Whether the floating element should shift to keep it in view.
Default
Section titled “Default”true
-
overlap:boolean -
Whether the floating element can overlap the reference element to keep it in view.
Default
Section titled “Default”false
-
fitViewport:boolean -
Whether to constrain the floating element's width and height to not exceed the viewport.
Default
Section titled “Default”false
-
sameWidth:boolean -
Whether to constrain the floating element's width so that it matches the reference element.
Default
Section titled “Default”false
-
sameHeight:boolean -
Whether to constrain the floating element's height so that it matches the reference element.
Default
Section titled “Default”false
-
inline:boolean -
Whether to improve positioning for inline reference elements that span over multiple lines.
Default
Section titled “Default”false
-
hide:boolean -
Whether to hide the floating element when the reference element or the floating element is fully clipped.
Default
Section titled “Default”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.
Default
Section titled “Default”'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.
Default
Section titled “Default”'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.
Default
Section titled “Default”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.
Default
Section titled “Default”'floating'
-
altBoundary:boolean -
Whether to check the alternate elementContext's boundary. Please see https://floating-ui.com/docs/detectoverflow#altboundary for more information.
Default
Section titled “Default”false
Methods
Section titled “Methods”-
addController(controller:ReactiveController):void
-
removeController(controller:ReactiveController):void
-
connectedCallback():void
-
disconnectedCallback():void
MenuRootElement
Section titled “MenuRootElement”<prosekit-menu-root> custom element.
Properties: MenuRootProps
Events: MenuRootEvents
Data attributes:
| Attribute | Description |
|---|---|
data-menu-root | Always present on the element |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”-
new MenuRootElement():MenuRootElement
Properties
Section titled “Properties”-
defaultOpen:boolean -
Whether the overlay is initially open.
Default
Section titled “Default”false
-
open:boolean|null -
Whether the overlay is currently open.
Default
Section titled “Default”null
-
disabled:boolean -
Whether the component should ignore user interaction.
Default
Section titled “Default”false
Methods
Section titled “Methods”-
addController(controller:ReactiveController):void
-
removeController(controller:ReactiveController):void
-
connectedCallback():void
-
disconnectedCallback():void
MenuSubmenuRootElement
Section titled “MenuSubmenuRootElement”<prosekit-menu-submenu-root> custom element.
Properties: MenuSubmenuRootProps
Events: MenuSubmenuRootEvents
Data attributes:
| Attribute | Description |
|---|---|
data-menu-submenu-root | Always present on the element |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”Properties
Section titled “Properties”-
defaultOpen:boolean -
Whether the overlay is initially open.
Default
Section titled “Default”false
-
open:boolean|null -
Whether the overlay is currently open.
Default
Section titled “Default”null
-
disabled:boolean -
Whether the component should ignore user interaction.
Default
Section titled “Default”false
Methods
Section titled “Methods”-
addController(controller:ReactiveController):void
-
removeController(controller:ReactiveController):void
-
connectedCallback():void
-
disconnectedCallback():void
MenuSubmenuTriggerElement
Section titled “MenuSubmenuTriggerElement”<prosekit-menu-submenu-trigger> custom element.
Properties: MenuSubmenuTriggerProps
Data attributes:
| Attribute | Description |
|---|---|
data-highlighted | Present when the item is the currently highlighted option |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”Properties
Section titled “Properties”-
value:string -
The unique value for this submenu trigger in the parent menu.
Default
Section titled “Default”""
-
disabled:boolean -
Whether this submenu trigger is disabled.
Default
Section titled “Default”false
Methods
Section titled “Methods”-
addController(controller:ReactiveController):void
-
removeController(controller:ReactiveController):void
-
connectedCallback():void
-
disconnectedCallback():void
MenuTriggerElement
Section titled “MenuTriggerElement”<prosekit-menu-trigger> custom element.
Properties: MenuTriggerProps
Events: MenuTriggerEvents
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”Properties
Section titled “Properties”-
disabled:boolean -
Whether the component should ignore user interaction.
Default
Section titled “Default”false
Methods
Section titled “Methods”-
addController(controller:ReactiveController):void
-
removeController(controller:ReactiveController):void
-
connectedCallback():void
-
disconnectedCallback():void
Interfaces
Section titled “Interfaces”MenuItemProps
Section titled “MenuItemProps”Properties
Section titled “Properties”-
value:string -
The unique value for this menu item.
Default
Section titled “Default”""
-
disabled:boolean -
Whether this menu item is disabled.
Default
Section titled “Default”false
-
closeOnSelect:boolean -
Whether to close the menu when the item is pressed.
Default
Section titled “Default”true
MenuPopupProps
Section titled “MenuPopupProps”Properties
Section titled “Properties”-
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.
Default
Section titled “Default”null
MenuPositionerProps
Section titled “MenuPositionerProps”Properties
Section titled “Properties”-
placement:Placement -
The initial placement of the floating element
Default
Section titled “Default”"bottom-start"
-
strategy:"fixed"|"absolute" -
The strategy to use for positioning
Default
Section titled “Default”"absolute"
-
autoUpdate:boolean|AutoUpdateOptions -
Options to activate auto-update listeners
https://floating-ui.com/docs/autoUpdate
Default
Section titled “Default”true
-
hoist:boolean -
Whether to use the browser Popover API to place the floating element on top of other page content.
Default
Section titled “Default”true
-
offset:OffsetOptions -
The distance between the reference and floating element.
Default
Section titled “Default”6
-
flip:boolean|Placement[] -
Whether to flip the
placementin 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 preferredplacementdoes not fit.Default
Section titled “Default”true
-
shift:boolean -
Whether the floating element should shift to keep it in view.
Default
Section titled “Default”true
-
overlap:boolean -
Whether the floating element can overlap the reference element to keep it in view.
Default
Section titled “Default”false
-
fitViewport:boolean -
Whether to constrain the floating element's width and height to not exceed the viewport.
Default
Section titled “Default”false
-
sameWidth:boolean -
Whether to constrain the floating element's width so that it matches the reference element.
Default
Section titled “Default”false
-
sameHeight:boolean -
Whether to constrain the floating element's height so that it matches the reference element.
Default
Section titled “Default”false
-
inline:boolean -
Whether to improve positioning for inline reference elements that span over multiple lines.
Default
Section titled “Default”false
-
hide:boolean -
Whether to hide the floating element when the reference element or the floating element is fully clipped.
Default
Section titled “Default”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.
Default
Section titled “Default”'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.
Default
Section titled “Default”'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.
Default
Section titled “Default”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.
Default
Section titled “Default”'floating'
-
altBoundary:boolean -
Whether to check the alternate elementContext's boundary. Please see https://floating-ui.com/docs/detectoverflow#altboundary for more information.
Default
Section titled “Default”false
MenuRootProps
Section titled “MenuRootProps”Properties
Section titled “Properties”-
defaultOpen:boolean -
Whether the overlay is initially open.
Default
Section titled “Default”false
-
open:boolean|null -
Whether the overlay is currently open.
Default
Section titled “Default”null
-
disabled:boolean -
Whether the component should ignore user interaction.
Default
Section titled “Default”false
MenuSubmenuRootProps
Section titled “MenuSubmenuRootProps”Properties
Section titled “Properties”-
defaultOpen:boolean -
Whether the overlay is initially open.
Default
Section titled “Default”false
-
open:boolean|null -
Whether the overlay is currently open.
Default
Section titled “Default”null
-
disabled:boolean -
Whether the component should ignore user interaction.
Default
Section titled “Default”false
MenuSubmenuTriggerProps
Section titled “MenuSubmenuTriggerProps”Properties
Section titled “Properties”-
value:string -
The unique value for this submenu trigger in the parent menu.
Default
Section titled “Default”""
-
disabled:boolean -
Whether this submenu trigger is disabled.
Default
Section titled “Default”false
MenuTriggerProps
Section titled “MenuTriggerProps”Properties
Section titled “Properties”-
disabled:boolean -
Whether the component should ignore user interaction.
Default
Section titled “Default”false
MenuItemEvents
Section titled “MenuItemEvents”Properties
Section titled “Properties”-
Emitted when the the item is selected.
MenuRootEvents
Section titled “MenuRootEvents”Properties
Section titled “Properties”-
Emitted when the menu is opened or closed.
MenuSubmenuRootEvents
Section titled “MenuSubmenuRootEvents”Properties
Section titled “Properties”-
Emitted when the submenu is opened or closed.
MenuTriggerEvents
Section titled “MenuTriggerEvents”Properties
Section titled “Properties”-
Emitted when the menu is opened or closed.
Functions
Section titled “Functions”registerMenuRootElement()
Section titled “registerMenuRootElement()”-
function registerMenuRootElement():void
registerMenuTriggerElement()
Section titled “registerMenuTriggerElement()”-
function registerMenuTriggerElement():void
registerMenuPositionerElement()
Section titled “registerMenuPositionerElement()”-
function registerMenuPositionerElement():void
registerMenuPopupElement()
Section titled “registerMenuPopupElement()”-
function registerMenuPopupElement():void
registerMenuItemElement()
Section titled “registerMenuItemElement()”-
function registerMenuItemElement():void
registerMenuSubmenuRootElement()
Section titled “registerMenuSubmenuRootElement()”-
function registerMenuSubmenuRootElement():void
registerMenuSubmenuTriggerElement()
Section titled “registerMenuSubmenuTriggerElement()”-
function registerMenuSubmenuTriggerElement():void
References
Section titled “References”OpenChangeEvent
Section titled “OpenChangeEvent”Re-exports OpenChangeEvent
SelectEvent
Section titled “SelectEvent”Re-exports SelectEvent