gohud

GoStyle — one place things are made

← Widgets

Call Button.new() directly and padding, height and wrapping drift slightly from screen to screen. That drift is invisible in code review and obvious in a screenshot.

GroupFunctions
Structurecolumn row wrap_row padding spacer divider responsive_grid aspect foldable
Textlabel label_key line section typography
Buttonsbutton button_key icon_button list_button list_row apply_icon style_choice_card style_chip_button style_chip_label
Inputline_edit textarea toggle checkbox slider picker select dropdown radio_group segmented choice_grid
Displaycard chip hud_panel chip_panel avatar skeleton alert table tabs breadcrumb progress empty_state
Surface piecessurface box floating disc face_padding
Helpersform fit_words natural_width tooltip_node card_body let_input_through
box() always returns a StyleBoxFlat, because callers receive it and adjust bg_color or corner_radius. Use surface() when a custom shape has to survive.

List rows with a description

GoStyle.list_button(GoIconSet.SWORD, "Oathkeeper", _inspect, Color.TRANSPARENT,
    "Longsword  /  Attack 42", false)

A row with a second line gets equal top and bottom padding, roomier than a single-line row, and the title/description pair stays vertically centred beside the icon — also when a container stretches the row taller, and after the description wraps onto several lines. The whole row remains one tap target.

medieval_light example — two-line list rows, quick slots and bars
Two-line rows, slots and bars in the medieval example — the same factory calls under medieval_light.

Flowing rows

Put controls into wrap_row at their natural width. With wrapping left on, a button's minimum width drops to almost nothing and the row sizes its cell by it — the label collapses to one character per line. The factory prevents this for you.

Never leave an empty list empty

page.add_child(GoStyle.empty_state(GoIconSet.BOX, "Nothing here yet"))

People read a blank screen as broken.

Subclass hooks

Every place a child widget is constructed goes through an overridable method, so a project that subclasses gohud types can get its own subclasses inside the widgets without copying code.

HookWidgetDefault
_make_scroll()GoCoachMark, GoSurfaceGoScroll.new()
_make_close_button()GoPromptCard, GoSurfaceGoIconButton.new()
_make_surface()GoSheet, GoDialogsGoSurface.new()
_should_pause()GoCoachMarkHides the card while a modal is open