Skip to content

UI Markup

Hytale uses a custom markup language for UI files (.ui). It’s a curly-brace DSL - not HTML, not XAML.

ElementType #OptionalId {
Property: value;
NestedProperty: (SubProp: value, SubProp2: value);
ChildElement {
Property: value;
}
}

Common element types:

ElementPurpose
GroupContainer for layout
LabelText display
TextButtonClickable button with text
TextInputText input field
SliderRange slider
DropdownDropdown selector
CheckboxToggle checkbox
ImageImage display
ItemSlotInventory slot

Prefix with # to assign an ID for server targeting:

Label #Score {
Text: 0;
}
TextButton #SubmitBtn {
Text: Submit;
}

Server-side:

cmd.set("#Score.Text", "100");
Group {
Anchor: (Width: 200, Height: 100, Left: 10, Top: 10);
Visible: true;
Background: "Textures/Panel.png";
LayoutMode: Left;
Padding: (Horizontal: 10, Vertical: 5);
}
Label {
Text: Hello World;
Style: (FontSize: 24, HorizontalAlignment: Center);
}
TextButton {
Text: Click Me;
Disabled: false;
}

Control how children are arranged:

ModeBehavior
LeftHorizontal left-to-right
TopVertical top-to-bottom
RightHorizontal right-to-left
BottomVertical bottom-to-top
CenterCentered
MiddleVertically centered
LeftCenterWrapLeft-to-right with wrapping
TopScrollingVertical with scrollbar
Group {
LayoutMode: TopScrolling;
// children stack vertically with scroll
}

Use parentheses for complex values:

Label {
Style: (
FontSize: 32,
FontName: "Secondary",
HorizontalAlignment: Center,
RenderBold: true,
RenderUppercase: true
);
Anchor: (Width: 200, Height: 50);
}

Import another .ui file as a variable:

$Common = "../Common.ui";
$Sounds = "../Sounds.ui";

Define reusable values with @:

@ButtonWidth = 200;
@LabelStyle = (
FontSize: 20,
HorizontalAlignment: Center
);
Label {
Anchor: (Width: @ButtonWidth);
Style: @LabelStyle;
}

Reference values from imported files:

$C = "../Common.ui";
TextButton {
Style: $C.@DefaultButtonStyle;
}

Merge values with ...:

$C = "../Common.ui";
TextButton {
Style: (
...$C.@DefaultButtonStyle,
FontSize: 24 // override
);
}

Use imported elements as templates:

$C = "../Common.ui";
$C.@PageOverlay {}
$C.@Container {
Anchor: (Width: 600, Height: 400);
// override nested element properties
#Title {
@Text = My Custom Title;
}
}

Prefix with % for localized text:

Label {
Text: %mymod.welcome.title;
}
TextButton {
Text: %mymod.buttons.submit;
}
Background: #FF0000; // RGB hex
Background: #000000(0.5); // with alpha (0-1)

See Styling for all color formats.

// this is a comment
Group {
// another comment
Text: value;
}
$C = "../Common.ui";
$Sounds = "../Sounds.ui";
@HeaderHeight = 60;
$C.@PageOverlay {}
Group {
Anchor: (Width: 500, Height: 400);
Background: #000000(0.8);
// header
Group {
Anchor: (Height: @HeaderHeight);
LayoutMode: Center;
Label #Title {
Text: %mymod.page.title;
Style: (
FontSize: 28,
FontName: "Secondary",
HorizontalAlignment: Center
);
}
}
// content area
Group #Content {
Anchor: (Top: @HeaderHeight, Bottom: 60);
LayoutMode: TopScrolling;
Padding: (Horizontal: 20, Vertical: 10);
}
// footer
Group {
Anchor: (Height: 60, Bottom: 0);
LayoutMode: Center;
TextButton #CloseBtn {
Anchor: (Width: 120, Height: 40);
Text: %common.close;
Style: (
...$C.@DefaultButtonStyle,
...$Sounds.@ButtonSounds
);
}
}
}