promotional bannermobile promotional banner
premium banner
A type-safe Kotlin DSL for building, serializing, and dynamically updating Hytale custom UI with automatic dirty tracking, diff-based updates, event handling, data binding, and form support.

Description

A type-safe Kotlin DSL for building and managing Hytale custom UI entirely from the server side.

Note: UiManager conflicts with MultipleHUD. If you have plugins that depend on MultipleHUD, install the MultipleHUD Adapter instead — it forwards all MultipleHUD API calls to UiManager.


Key features:

  • Kotlin DSL for composing UI trees with auto-generated node classes
  • Pages and HUDs with automatic dirty tracking and diff-based updates
  • Data binding to observable properties
  • Event handling with value capture from input fields
  • Form support with automatic field binding
  • Pre-styled templates matching Hytale's vanilla UI
UiManager.registerPage("welcome", Unit) { playerRef, _ ->
    pageOverlay {
        decoratedContainer {
            title { defaultTitle { text = "Welcome".toMessage() } }

            content {
                layoutMode = LayoutMode.Top
                padding = UiPadding(full = 16)

                val nameField = defaultTextField {
                    placeholderText = "Enter your name".toMessage()
                }

                defaultTextButton {
                    text = "Greet".toMessage()
                    onActivate(nameField::value) { name ->
                        playerRef?.sendMessage("Hello, $name!")
                    }
                }
            }
        }
    }
}

// Show to a player
UiManager.showPage(playerRef, "welcome")

For full documentation and examples, see the GitHub repository.