Skip to content

Widgets

GolemNikidastrov edited this page Apr 21, 2026 · 1 revision

All widgets inherit the base WidgetKwargs parameters:

  • id (str): Unique identifier (for searching via layout.get_item_by_id()).
  • z (int): Z-index (the higher, the closer to the top).
  • tooltip (Tooltip): A tooltip shown on hover.
  • clickable (bool): Whether it reacts to clicks.
  • hoverable (bool): Whether it reacts to hovering.
  • ripple_effect (bool): Enables a ripple effect on click (Raylib only).
  • subtheme_role (SubThemeRole): Color role (PRIMARY, SECONDARY, TERTIARY, ERROR).

Label

Displays text.

  • Constructor: Label(text: str, size, style, **kwargs)
  • Specific kwargs:
    • words_indent (bool): Word wrapping (instead of character wrapping).
  • Properties:
    • text (str): Allows dynamically changing the text.

Button

Clickable text/button.

  • Constructor: Button(function: Callable, text: str, size, style, **kwargs)
  • Specific kwargs:
    • is_active (bool): If False, the button cannot be clicked.
    • throw_errors (bool): Whether to propagate errors from function upwards.

Input

Text input field.

  • Constructor: Input(size, style, default="", placeholder="", on_change_function=None, **kwargs)
  • Specific kwargs:
    • multiple (bool): Multiline input.
    • max_characters (int): Character limit.
    • whitelist / blacklist (str | list): Allowed/forbidden characters (see InputType).
    • allow_paste (bool): Allow Ctrl+V pasting.
    • padding (tuple): Text padding inside the field (left, top, right, bottom).
  • Properties:
    • text (str): The currently entered text.

ProgressBar

Progress indicator.

  • Constructor: ProgressBar(size, style, **kwargs)
  • Specific kwargs:
    • min_value (float): Minimum value (default is 0).
    • max_value (float): Maximum value (default is 100).
    • value (float): Current value.
    • color_pair_role (PairColorRole): Color role of the filled part.
  • Properties:
    • progress (float): Progress from 0.0 to 1.0.
    • value (float): Set a specific value.

Slider

A slider for selecting a value.

  • Constructor: Slider(size, style, **kwargs)
  • Specific kwargs:
    • start (float): Start of the scale.
    • end (float): End of the scale.
    • step (float): Step of change.
    • current_value (float): Current value.
    • progress_style (Style): Style of the inner bar.

RectCheckBox

A rectangular checkbox.

  • Constructor: RectCheckBox(size, style, **kwargs)
  • Specific kwargs:
    • function / on_toggle (Callable): Function called upon toggling (accepts bool).
    • toggled (bool): Initial state.
    • active_rect_factor (float): Size of the inner square when toggled on (from 0.0 to 1.0).
    • checkbox_group (CheckBoxGroup): Group for creating RadioButton behavior.

ElementSwitcher

Element switcher (a carousel with < > arrows).

  • Constructor: ElementSwitcher(size, elements: list[Element | str], style, **kwargs)
  • Specific kwargs:
    • on_content_change (Callable): Called upon switching.
    • current_index (int): Starting index.
    • left_text / right_text (str): Text on the buttons (default is < and >).
  • Methods:
    • next(), previous() — switch to the next/previous.
    • move_to(id: str) — switch to an element by ID.

Clone this wiki locally