Skip to content

UIBuilder & Default Classes Reference ​

UIBuilder is passed as ui into Panel.draw(self, ui, context) and Panel.build(self, ui). Every container method supports both with context blocks and Blender-style chaining (row = card.row(); row.label(...)).

Container Methods ​

All container and element methods accept common keyword arguments: id, cls, style (dict or CSS string), on_click, on (dict of {event: callback}), visible=True, and arbitrary HTML **attrs.

MethodSignatureDefault ClassDescription
ui.rowrow(*, gap=None, align=None, justify=None, ...).bl-rowHorizontal Flexbox container.
ui.colcol(*, gap=None, align=None, justify=None, ...).bl-colVertical Flexbox container.
ui.cardcard(*, title=None, subtitle=None, ...).bl-cardBlender-themed card with optional header title and subtitle.
ui.sectionsection(title: str, ...).bl-sectionTitled vertical group.
ui.divdiv(text=None, ...)—Generic <div> container.
ui.spanspan(text=None, ...)—Inline <span> element.
ui.elel(tag: str, text=None, ...)—Arbitrary HTML element (e.g. ui.el("footer", cls="bar")).

Display & Content Widgets ​

MethodSignatureDescription
ui.labellabel(content="", *, bind=None, target=None, prop=None, default="", format_fn=None, as_html=False, tag="span", ...)Static or reactive text/HTML label.
ui.headingheading(content="", *, level=2, ...)Section heading (.bl-heading.bl-h1, .bl-h2, .bl-h3).
ui.badgebadge(label="", *, variant="", bind=None, target=None, prop=None, default="", format_fn=None, ...)Compact pill badge. Variants: "", "accent", "success", "warning", "error".
ui.dividerdivider(...)Horizontal 1px rule (.bl-divider).
ui.iconicon(name, *, size=16, color=None, stroke_width=None, tintable=True, ...)Inline vector <svg> icon via blendcss.svg_icon.
ui.imgimg(src, ...)Image element supporting local file paths and blendcss:// live GPU textures.
ui.progressprogress(value=0.0, *, max_val=1.0, fill_cls="", ...)Progress bar returning a ProgressNode with a live .value property.
ui.rawraw(html_str: str)Inserts raw HTML/RML markup verbatim inside the current container.

Interactive Controls ​

ui.button(...) ​

python
ui.button(
    label="",
    *,
    icon=None,
    icon_size=14,
    variant="",            # "", "primary", "ghost", "danger"
    on_click=None,
    on=None,
    operator=None,         # Optional: bind a Blender operator directly
    op_props=None,
    exec_ctx="INVOKE_DEFAULT",
    undo=True,
    disabled_class="is-disabled",
    sync_poll=True,
    context_override="AUTO",
    on_done=None,
    on_error=None,
    id=None,
    cls="",
    style=None,
    visible=True,
    **attrs,
)

ui.operator(...) ​

Returns an OperatorNode with .enabled (bool) and .invoke(**extra_props). Any extra **op_kwargs are passed as Blender operator properties.

python
ui.operator(
    operator,              # "mod.op", "MOD_OT_op", or bpy.ops.mod.op
    label=None,            # Defaults to Blender's RNA operator name
    *,
    icon=None,
    icon_size=14,
    variant="",            # "", "primary", "ghost", "danger"
    props=None,            # Static dict or callable returning dict
    exec_ctx="INVOKE_DEFAULT",
    undo=True,
    event="click",
    disabled_class="is-disabled",
    sync_poll=True,
    context_override="AUTO",
    on_done=None,
    on_error=None,
    id=None,
    cls="",
    style=None,
    visible=True,
    attrs=None,
    **op_kwargs,
)

ui.number(...) ​

Returns a NumberNode with .value, .binding, .box, and .value_el. Supports horizontal drag-scrubbing (Shift fine, Ctrl snap) and click-to-type AST math expressions.

python
ui.number(
    label=None,
    *,
    value=0.0,
    bind=None,             # (target, "prop") or (target, "prop", index)
    target=None,
    prop=None,
    index=None,
    step=0.01,
    min_val=None,
    max_val=None,
    precision=2,
    unit="",
    is_rotation=False,     # Displays degrees, stores radians
    on_change=None,
    formatter=None,
    id=None,
    cls="",
    box_cls="",
    val_cls="",
    style=None,
    visible=True,
    **attrs,
)

ui.toggle(...) ​

Returns a ToggleNode with .value, .binding, and .switch.

python
ui.toggle(
    label=None,
    *,
    subtitle=None,
    value=False,
    bind=None,
    target=None,
    prop=None,
    active_class="is-on",
    inactive_class=None,
    on_change=None,
    id=None,
    cls="",
    switch_cls="",
    style=None,
    visible=True,
    **attrs,
)

ui.tabs(...) and ui.choice(...) ​

Both return a ChoiceNode with .value and .binding. items accepts a {value: label} dict or a list of (value, label) tuples.

python
ui.tabs(items, *, value=None, bind=None, target=None, prop=None, active_class="is-active", on_change=None, id=None, cls="", item_cls="", style=None, visible=True, **attrs)
ui.choice(items, *, value=None, bind=None, target=None, prop=None, active_class="is-active", on_change=None, id=None, cls="", item_cls="", style=None, visible=True, **attrs)

Live Node Handles (UINode & ElementHandle) ​

Every UIBuilder widget returns a UINode (and doc["id"] / doc.el("id") returns an ElementHandle) with the following live API:

MemberType / SignatureDescription
.textstr (get/set)Escaped plain text inside the element.
.htmlstr (get/set)Inner HTML/RML markup.
.visiblebool (get/set)Shows or hides the element while preserving its prior display mode.
.show(display=None) / .hide()methodExplicitly shows or hides the element.
.style(prop=None, value=None, **styles)methodSets inline CSS properties (underscores convert to hyphens, e.g. background_color="#333").
.attr(name, value=...)methodGets or sets an HTML attribute.
.add_class(*names) / .remove_class(*names)methodAdds or removes CSS classes.
.set_class(name, activate) / .toggle_class(name) / .has_class(name)methodToggles or queries a CSS class.
.on(event_type, callback)methodAttaches an event listener.
.bind_operator(operator, ...)methodBinds a Blender operator to this node.
.width, .height, .left, .topfloat (read-only)Computed layout geometry in pixels.

Default CSS Classes (DEFAULT_UI_CSS) ​

Loaded automatically unless default_styles = False:

  • Layout: .bl-row, .bl-col, .bl-card, .bl-card-header, .bl-card-title, .bl-card-subtitle, .bl-section, .bl-section-title, .bl-divider
  • Typography: .bl-heading, .bl-h1, .bl-h2, .bl-h3
  • Buttons: .bl-btn, .bl-btn-flex, .bl-btn-primary, .bl-btn-ghost, .bl-btn-danger, .bl-btn-icon
  • Badges & Progress: .bl-badge, .bl-badge-accent, .bl-badge-success, .bl-badge-warning, .bl-badge-error, .bl-progress, .bl-progress-fill
  • Inputs: .bl-num-row, .bl-num-label, .bl-num-box, .bl-num-val, .bl-toggle-row, .bl-toggle-info, .bl-toggle-label, .bl-toggle-sub, .bl-switch, .bl-switch.is-on, .bl-switch-thumb
  • Tabs & Choices: .bl-tabs, .bl-tab, .bl-tab.is-active, .bl-choice-group, .bl-choice-item, .bl-choice-item.is-active

Released under the GNU GPL v3.0 License.