Skip to content

UI File Reference

Hytale uses a declarative .ui file format for defining user interfaces. This guide covers the syntax, elements, and properties available.

API Reference

See full API: CustomUIPage | UICommandBuilder | UIEventBuilder

Concepts

Before reading this, familiarize yourself with Creating a Plugin.

File Syntax

Basic Structure

ElementType #ElementId {
  Property: value;
  Property: (SubProperty: value, SubProperty: value);

  ChildElement #ChildId {
    Property: value;
  }
}

Variables and Imports

// Import another .ui file as a variable
$C = "../Common.ui";
$Nav = "Nav/TopNavigationBar.ui";

// Define a constant
@MyConstant = 100;

// Define a style
@MyLabelStyle = LabelStyle(TextColor: #ffffff, FontSize: 16);

// Reference a template from an imported file
$C.@PageOverlay {
  // Content using the PageOverlay template from Common.ui
}

// Reference a named value from another file
$C.@DefaultScrollbarStyle

// Spread operator to inherit properties
@ExtendedStyle = LabelStyle(...@MyLabelStyle, RenderBold: true);

Template Syntax

  • $Variable = "path/to/file.ui" - Import a file
  • $Variable.@TemplateName - Use a template from imported file
  • #ElementId - Assign an ID to an element (for selector access)
  • @Name = value - Define a named constant or template
  • ...@Name - Spread/inherit from another definition

UI Elements

Note

UI elements are defined client-side in Hytale's UI framework. This documentation is based on actual client .ui files.

Group

Container element for organizing child elements.

Group #MyContainer {
  Anchor: (Width: 600, Height: 400);
  LayoutMode: Top;
  Padding: (Left: 10, Right: 10);
  Background: #000000(0.5);
  Visible: true;

  // Child elements...
}

Properties:

PropertyTypeDescription
AnchorAnchorPositioning and sizing
LayoutModeStringLayout mode (see below)
PaddingPaddingInner spacing
FlexWeightNumberFlex layout weight
BackgroundString/PatchStyleBackground color or texture
ScrollbarStyleScrollbarStyleScrollbar styling
VisibleBooleanShow/hide the element
TextTooltipStyleTextTooltipStyleTooltip on hover

LayoutMode values: Left, Right, Top, Bottom, Center, Middle, Full, TopScrolling, BottomScrolling, MiddleCenter, CenterMiddle

Label

Text display element.

Label #MyLabel {
  Text: "Hello World";
  Style: @MyLabelStyle;
}

Properties:

PropertyTypeDescription
TextStringText content (use %key for localization)
StyleLabelStyleText styling
TextTooltipStyleTextTooltipStyleTooltip on hover

Button

Interactive button element (no text, use with child Label or use TextButton).

Button #MyButton {
  Anchor: (Width: 44, Height: 44);
  Style: @MyButtonStyle;
}

Properties:

PropertyTypeDescription
AnchorAnchorPositioning and sizing
StyleButtonStyleButton styling
PaddingPaddingInner padding

TextButton

Button with built-in text label.

TextButton #MyButton {
  Anchor: (Height: 44);
  Style: @PrimaryTextButtonStyle;
  Padding: (Horizontal: 24);
  Text: "Click Me";
}

Properties:

PropertyTypeDescription
AnchorAnchorPositioning and sizing
StyleTextButtonStyleButton and label styling
PaddingPaddingInner padding
TextStringButton text

TextField

Text input field.

TextField #SearchInput {
  Anchor: (Width: 170, Height: 28);
  Style: (FontSize: 15, TextColor: #a5b4c4);
  Padding: (Left: 8);
  Background: @InputBoxBackground;
}

Properties:

PropertyTypeDescription
AnchorAnchorPositioning and sizing
StyleInputFieldStyleText styling
PaddingPaddingInner padding
BackgroundPatchStyleBackground

CheckBox

Boolean toggle element.

CheckBox #MyCheckbox {
  Anchor: (Width: 18, Height: 18);
  Background: "CheckBoxFrame.png";
  Padding: (Full: 4);
  Style: @DefaultCheckBoxStyle;
}

Properties:

PropertyTypeDescription
AnchorAnchorPositioning and sizing
BackgroundStringBackground texture
PaddingPaddingInner padding
StyleCheckBoxStyleCheckbox styling

Dropdown selection element.

DropdownBox #MyDropdown {
  Anchor: (Width: 194, Height: 42);
  Style: @DefaultDropdownBoxStyle;
}

Properties:

PropertyTypeDescription
AnchorAnchorPositioning and sizing
StyleDropdownBoxStyleDropdown styling

SliderNumberField

Slider with numeric input field.

SliderNumberField #MySlider {
  Anchor: (Width: 180, Height: 5);
  SliderStyle: @DefaultSliderStyle;
  NumberFieldContainerAnchor: (Left: 15, Width: 30, Height: 15);
  NumberFieldStyle: (FontSize: 14, TextColor: #a5b4c4);
  Min: 1;
  Max: 100;
}

Properties:

PropertyTypeDescription
AnchorAnchorPositioning and sizing
PaddingPaddingInner padding
SliderStyleSliderStyleSlider styling
NumberFieldContainerAnchorAnchorNumber field position
NumberFieldStyleInputFieldStyleNumber field styling
MinNumberMinimum value
MaxNumberMaximum value

ProgressBar

Progress indicator.

ProgressBar #HealthBar {
  Anchor: (Width: 158, Height: 8);
  BarTexturePath: "HealthBarFill.png";
}

Properties:

PropertyTypeDescription
AnchorAnchorPositioning and sizing
BarTexturePathStringFill texture path

ItemGrid

Grid of item slots.

ItemGrid #Inventory {
  Anchor: (Width: 300, Height: 200);
  SlotsPerRow: 9;
  Style: @DefaultItemGridStyle;
  Background: #202c3b(0);
  Padding: 2;
}

Properties:

PropertyTypeDescription
AnchorAnchorPositioning and sizing
SlotsPerRowNumberItems per row
StyleItemGridStyleGrid styling
BackgroundStringBackground color
PaddingNumberGrid padding

ActionButton

Button that shows a keybind hint.

ActionButton #PickItem {
  Alignment: Right;
  ActionName: %client.inventory.action.pickHalf;
  Disabled: true;
  LayoutMode: Right;
}

Properties:

PropertyTypeDescription
AlignmentStringAlignment
ActionNameStringLocalized action name
DisabledBooleanDisabled state
LayoutModeStringLayout mode

Sprite

Animated image element.

Sprite #Spinner {
  Anchor: (Width: 32, Height: 32);
  TexturePath: "Common/Spinner.png";
  Frame: (Width: 32, Height: 32, PerRow: 8, Count: 72);
  FramesPerSecond: 30;
}

Properties:

PropertyTypeDescription
AnchorAnchorPositioning and sizing
TexturePathStringSprite sheet path
FrameFrameFrame configuration
FramesPerSecondNumberAnimation speed

AssetImage

Image loaded from assets.

AssetImage #Icon {
  Anchor: (Width: 128, Height: 128);
}

Properties:

PropertyTypeDescription
AnchorAnchorPositioning and sizing

SceneBlur

Blurs the game scene behind the UI.

SceneBlur {}

No properties - just add it to enable background blur.

TabNavigation / TabButton

Tab-based navigation.

TabNavigation #Tabs {
  // Tab buttons defined here
  TabButton #Tab1 { ... }
  TabButton #Tab2 { ... }
}

Style Types

LabelStyle

Text styling for labels.

LabelStyle(
  FontSize: 17,
  TextColor: #bfcdd5,
  RenderBold: true,
  RenderUppercase: true,
  HorizontalAlignment: Center,
  VerticalAlignment: Center,
  LetterSpacing: 2,
  Wrap: true
)
PropertyTypeValues
FontSizeNumberFont size in pixels
TextColorColorText color
RenderBoldBooleanBold text
RenderUppercaseBooleanUppercase text
HorizontalAlignmentStringStart, Center, End
VerticalAlignmentStringStart, Center, End
LetterSpacingNumberLetter spacing
WrapBooleanText wrapping

PatchStyle

9-patch textured background.

PatchStyle(
  TexturePath: "Common/Button.png",
  Border: 12
)

PatchStyle(
  TexturePath: "Common/Button.png",
  VerticalBorder: 12,
  HorizontalBorder: 80
)

PatchStyle(Color: #000000(0.82))
PropertyTypeDescription
TexturePathStringPath to texture
BorderNumberBorder size (all sides)
VerticalBorderNumberTop/bottom border
HorizontalBorderNumberLeft/right border
ColorColorSolid color instead of texture

ButtonStyle

Button state styling.

ButtonStyle(
  Default: (Background: @DefaultBackground),
  Hovered: (Background: @HoveredBackground),
  Pressed: (Background: @PressedBackground),
  Disabled: (Background: @DisabledBackground),
  Sounds: @ButtonSounds
)

TextButtonStyle

Button with label styling per state.

TextButtonStyle(
  Default: (Background: @DefaultBackground, LabelStyle: @LabelStyle),
  Hovered: (Background: @HoveredBackground, LabelStyle: @LabelStyle),
  Pressed: (Background: @PressedBackground, LabelStyle: @LabelStyle),
  Disabled: (Background: @DisabledBackground, LabelStyle: @DisabledLabelStyle),
  Sounds: @ButtonSounds
)

ScrollbarStyle

Scrollbar styling.

ScrollbarStyle(
  Spacing: 6,
  Size: 6,
  Background: (TexturePath: "Scrollbar.png", Border: 3),
  Handle: (TexturePath: "ScrollbarHandle.png", Border: 3),
  HoveredHandle: (TexturePath: "ScrollbarHandleHovered.png", Border: 3),
  DraggedHandle: (TexturePath: "ScrollbarHandleDragged.png", Border: 3),
  OnlyVisibleWhenHovered: true
)

SliderStyle

Slider styling.

SliderStyle(
  Background: (TexturePath: "SliderBackground.png", Border: 2),
  Handle: "SliderHandle.png",
  HandleWidth: 16,
  HandleHeight: 16,
  Sounds: (Activate: @SliderRelease, MouseHover: @HoverSound)
)

CheckBoxStyle

Checkbox styling.

CheckBoxStyle(
  Unchecked: (
    DefaultBackground: (Color: #00000000),
    HoveredBackground: (Color: #00000000),
    PressedBackground: (Color: #00000000),
    DisabledBackground: (Color: #424242),
    ChangedSound: @UntickSound
  ),
  Checked: (
    DefaultBackground: (TexturePath: "Checkmark.png"),
    HoveredBackground: (TexturePath: "Checkmark.png"),
    PressedBackground: (TexturePath: "Checkmark.png"),
    ChangedSound: @TickSound
  )
)

ItemGridStyle

Item grid styling.

ItemGridStyle(
  SlotSpacing: 2,
  SlotSize: 74,
  SlotIconSize: 64,
  SlotBackground: "Slot.png",
  DefaultItemIcon: "UnknownItemIcon.png",
  DurabilityBar: "DurabilityBar.png",
  DurabilityBarBackground: "DurabilityBarBackground.png",
  DurabilityBarAnchor: (Bottom: 10, Left: 13, Width: 48, Height: 2),
  DurabilityBarColorStart: #a63232,
  DurabilityBarColorEnd: #63b649
)

Properties Reference

Anchor

Controls element positioning and sizing.

Anchor: (Width: 600, Height: 400);
Anchor: (Left: 10, Right: 10, Top: 0, Bottom: 0);
Anchor: (Full: 1);  // Fill parent
Anchor: (Horizontal: 1);  // Fill horizontally
Anchor: (Vertical: 1);  // Fill vertically
PropertyTypeDescription
LeftNumberLeft offset
RightNumberRight offset
TopNumberTop offset
BottomNumberBottom offset
WidthNumberFixed width
HeightNumberFixed height
MinWidthNumberMinimum width
MaxWidthNumberMaximum width
FullNumberFill both axes
HorizontalNumberFill horizontal
VerticalNumberFill vertical

Padding

Inner spacing.

Padding: (Left: 10, Right: 10, Top: 5, Bottom: 5);
Padding: (Horizontal: 10, Vertical: 5);
Padding: (Full: 10);
PropertyTypeDescription
LeftNumberLeft padding
RightNumberRight padding
TopNumberTop padding
BottomNumberBottom padding
HorizontalNumberLeft + Right
VerticalNumberTop + Bottom
FullNumberAll sides

Color Format

Colors can be specified as:

  • Hex: #ffffff or #fff
  • Hex with alpha: #ffffff(0.5) or #000000(0.82)
  • Named constant: @DisabledColor

Selectors

Selectors are used to target elements for manipulation.

java
// Direct element by ID
"#ElementId"

// Array index access
"#List[0]"
"#List[2]"

// Child element access
"#Parent #Child"
"#Container[0] #Button"

// Property access
"#Element.Property"
"#Element.Style.TextColor"
"#Element[0].Visible"

UICommandBuilder Usage[^1]

Manipulate UI from Java code:

java
@Override
public void build(@Nonnull Ref<EntityStore> ref,
                  @Nonnull UICommandBuilder commandBuilder,
                  @Nonnull UIEventBuilder eventBuilder,
                  @Nonnull Store<EntityStore> store) {

    // Load a .ui file
    commandBuilder.append("Pages/MyPage.ui");

    // Set text
    commandBuilder.set("#Title.Text", "Welcome!");
    commandBuilder.set("#Description.Text", Message.translation("my.description"));

    // Set visibility
    commandBuilder.set("#ErrorMessage.Visible", false);

    // Set style from another file
    commandBuilder.set("#Button.Style", Value.ref("Pages/Common.ui", "ButtonStyle"));

    // Clear and rebuild lists
    commandBuilder.clear("#ItemList");
    for (int i = 0; i < items.size(); i++) {
        commandBuilder.append("#ItemList", "Pages/ListItem.ui");
        commandBuilder.set("#ItemList[" + i + "].Text", items.get(i).getName());
    }

    // Inline element creation
    commandBuilder.appendInline("#Container",
        "Group { LayoutMode: Left; Anchor: (Bottom: 0); }");

    // Set dropdown entries
    List<DropdownEntryInfo> options = new ArrayList<>();
    options.add(new DropdownEntryInfo(
        LocalizableString.fromString("Option 1"), "opt1"));
    options.add(new DropdownEntryInfo(
        LocalizableString.fromString("Option 2"), "opt2"));
    commandBuilder.set("#Dropdown.Entries", options);
    commandBuilder.set("#Dropdown.Value", "opt1");

    // Set Anchor dynamically
    Anchor anchor = new Anchor();
    anchor.setHeight(Value.of(120 + (count * 18)));
    commandBuilder.setObject("#DynamicGroup.Anchor", anchor);
}

UIEventBuilder Usage[^2]

Bind events to elements:

java
// Button click
eventBuilder.addEventBinding(
    CustomUIEventBindingType.Activating,
    "#MyButton",
    EventData.of("Action", "submit")
);

// Input value change (with @ prefix to read value)
eventBuilder.addEventBinding(
    CustomUIEventBindingType.ValueChanged,
    "#SearchInput",
    EventData.of("@SearchQuery", "#SearchInput.Value"),
    false  // Don't trigger rebuild
);

// Dropdown selection
eventBuilder.addEventBinding(
    CustomUIEventBindingType.ValueChanged,
    "#CategoryDropdown",
    EventData.of("@Category", "#CategoryDropdown.Value")
);

Event Types[^3]

EventDescription
ActivatingElement clicked/activated
RightClickingRight-click on element
DoubleClickingDouble-click
MouseEnteredMouse enters element
MouseExitedMouse exits element
ValueChangedInput value changed
ElementReorderedElement order changed
ValidatingInput validation
DismissingPage being dismissed
FocusGainedElement gained focus
FocusLostElement lost focus
KeyDownKey pressed
MouseButtonReleasedMouse button released
SlotClickingItem slot clicked
SlotDoubleClickingItem slot double-clicked
SlotMouseEnteredMouse entered slot
SlotMouseExitedMouse exited slot
DragCancelledDrag operation cancelled
DroppedItem dropped
SlotMouseDragCompletedSlot drag completed
SlotMouseDragExitedMouse exited during slot drag
SlotClickReleaseWhileDraggingClick released while dragging slot
SlotClickPressWhileDraggingClick pressed while dragging slot
SelectedTabChangedTab selection changed

See Also

[^1]: See UICommandBuilder API for all methods including append(), appendInline(), set(), clear(), remove(), insertBefore()

[^2]: See UIEventBuilder API for addEventBinding() overloads with optional EventData and locksInterface parameters

[^3]: Event types are from CustomUIEventBindingType enum in com.hypixel.hytale.protocol.packets.interface_

Unofficial documentation · Any questions? Found a mistake? Have something you want documented? Join the Discord server at the top and let us know in #hytale!