Skip to content
Logo LogoLcdMenu
Docs Changelog License
⌘ K
Logo LogoLcdMenu
Docs Changelog License

Overview

  • Getting started
  • Menu Screen
  • Item overview
    • Basic menu item
    • Value display item
    • Command menu item
    • Sub-menu item
    • Item Widget
    • Item List
    • Item Range
    • Item Bool
    • Input item
    • Charset input item
  • Widget overview
    • WidgetBool
    • WidgetList
    • WidgetRange
  • Controlling the menu
    • Keyboard Adapter
    • Button Adapter
    • Rotary Encoder Adapter
    • Analog Button Adapter
  • Rendering the menu
    • Character display renderer

Reference

  • Code samples
    • InputRotary
    • SubMenu
    • SimpleRotary
    • IntFloatValues
    • SimpleInput
    • KeyboardAdapter
    • pcf8574_i2c
    • ItemValue
    • RTOS
    • KeypadShield
    • ViewShifting
    • MenuTimeout
    • DynamicMenu
    • ButtonWithRotaryAdapter
    • UseByRef
    • List
    • ItemBack
    • Basic
    • Widgets
    • Callbacks
    • CharsetInput
    • SSD1803A_I2C
    • ButtonAdapter
  • API reference
    • MenuItem
    • ItemCommand
    • MenuScreen
    • ItemBool
    • ItemInput
    • ItemSubMenu
    • ItemToggle
    • ItemInputCharset
    • ItemValue
    • ItemWidget
    • ItemRange
    • BaseItemManyWidgets
    • ItemList
    • ItemBack
    • LcdMenu
    • BaseItemZeroWidget
    • renderer
    • input
    • display
    • widget
  • Migration
  • FAQ

Star on GitHub
Edit on GitHub
Arduino Library Badge PlatformIO Badge Check Runs Badge Documentation Status Badge GitHub Commits Badge

LcdMenu
/
Item overview
/
Sub-menu item

Sub-menu item

The sub-menu item is a menu item that opens a new menu screen when selected. It is used to create a hierarchical menu structure with multiple levels of navigation.

This can be useful for organizing menu items into categories or sub-menus, making it easier for users to navigate through the menu system.

A sub-menu item can be created using the following syntax:

You first need to define the sub-menu screen with the desired menu items:

MENU_SCREEN(subMenuScreen, subMenuItems,
    ITEM_BASIC("Sub-item 1"),
    ITEM_BASIC("Sub-item 2"),
    ITEM_BASIC("Sub-item 3"),
    ITEM_BASIC("Sub-item 4"));

Then you can create a sub-menu item entry that links to the sub-menu screen in the parent menu:

// ... More menu items
ITEM_SUBMENU("Sub-menu 1", subMenuScreen)
// ... More menu items

When the Sub-menu 1 menu item is selected, the sub-menu screen will be displayed, showing the list of sub-items.

Example of a sub-menu item

You can create multiple levels of sub-menus by nesting sub-menu items within other sub-menu screens.

After a sub-menu screen is created, you can add items to it using MenuScreen::addItem() or remove items using MenuScreen::removeItem(), MenuScreen::removeLastItem() on runtime. This allows you to dynamically update the sub-menu items based on user input or other conditions, an example of this can be a settings menu where the user can choose a WiFi network to connect to, and the list of available networks is updated based on the scan results. See the dynamic menu example for more information.

You can also update the screen that is displayed when the sub-menu item is selected by using the ItemSubMenu::setScreen() function on runtime.

Find more information about the sub-menu item in the API reference.

Command menu item
Item Widget

© 2025, Thomas Forntoh