Components

Dropdown

The Dropdown Component.

The dropdown component creates a dropdown menu with various entries such as buttons, checkboxes, and nested dropdowns. It supports customizable entries and various sizing and alignment options.

Parameters

close-when-not-hovered
boolean
Whether to automatically close the dropdown when the mouse is not hovering over it.
entries
The entries of the dropdown menu.
padding
int | (int,int,int,int)
The padding around the dropdown entries.
surface
#hex
The background surface of the dropdown.
horizontal-alignment
left | right | center
The horizontal alignment of the dropdown entries.
vertical-alignment
top | middle | bottom
The vertical alignment of the dropdown entries.
allow-overflow
boolean
Whether to allow the dropdown entries to overflow the bounds of the dropdown.

Examples

Components.dropdown()
    .button(Text.literal("Option 1"), button -> {
        // Handle button click event
    })
    .checkbox(Text.literal("Option 2"), false)
    .nested(Text.literal("Submenu"), submenu -> {
        submenu.button(Text.literal("Submenu Option"), button -> {
            // Handle submenu button click event
        });
    })
    .closeWhenNotHovered(true)
    .padding(Insets.of(5))
    .surface(Surface.TOOLTIP)
Copyright © 2026