Skip to main content

MenuOption class

📖 Description​

The MenuOption class is an abstract class for creating menu option controls for the Menu class.


🆕 constructor​

Creates a new MenuOption instance.

Signature​

constructor(
disabled: boolean,
interactable: boolean
): MenuOption

Parameters​

NameTypeOptionalDescription
disabledbooleanNoSpecifies the disabled state.
interactablebooleanNoSpecifies if the option is interactable or static.

Return value​

Returns a reference to the new MenuOption instance.

🗃️ Fields​


🏷️ canOpen​

Retrieves if the option can be opened.

Type​

boolean


🏷️ closeOnTap​

Retrieves if the menu should be closed when the option is tapped.

Type​

boolean


🏷️ isDisabled​

Sets or retrieves if the option is disabled.

Type​

boolean


🏷️ isHovered​

Sets or retrieves if the option is hovered.

Type​

boolean


🏷️ isOpen​

Retrieves if an option is opened.

Type​

boolean


🏷️ isSelected​

Sets or retrieves if the option is in the selected state.

Type​

boolean


Retrieves a reference to the menu.

Type​

Menu | undefined

📢 Events​


🔔 onClose​

Fired when an option is closed.

Signature​

(option: MenuOption, animate: boolean) => void

Parameters​

NameTypeOptionalDescription
optionMenuOptionNoReference to the option.
animatebooleanNoSpecifies if an animation should be used.

🔔 onDestroy​

Fired when an option is destroyed.

Signature​

(option: MenuOption) => void

Parameters​

NameTypeOptionalDescription
optionMenuOptionNoReference to the option.

🔔 onOpen​

Fired when an option is opened.

Signature​

(option: MenuOption) => void

Parameters​

NameTypeOptionalDescription
optionMenuOptionNoReference to the option.

🔔 onRemove​

Fired when an option is removed.

Signature​

(option: MenuOption) => void

Parameters​

NameTypeOptionalDescription
optionMenuOptionNoReference to the option.

🔔 onTap​

Fired when an option is tapped.

Signature​

(option: MenuOption) => void

Parameters​

NameTypeOptionalDescription
optionMenuOptionNoReference to the option.